Yes, like everyone else I too had this question before
starting out to explore Google's Go programming language or Golang.
What specific problems does this new language solve that are
not possible to solve (efficiently) with the existing languages? If you've
reached this blog, I assume, you must have already heard numerous conference
talks and Youtube presentations / videos on Go Programming and they all point
out Concurrent Programming as the USP of Go.
Before I share my personal experience, as why Go is required
at first place, I would like to borrow the argument from Go creators and
simplify them here in my own words.
The Gopher image credit goes to - Renee French's Go Gopher Mascot
Multicore processors were introduced almost a decade back and
nowadays Intel's current lineup of desktop version of Core i7 extreme edition
has 8 cores! and mobile version has 4 cores. Almost all the popular languages
viz. Java, C# & Python etc. are too old to keep pace with this
revolutionary evolution in hardware. They all were built with single core
processor in mind and the support for multicore was later worked around and stitched
over as a patch work. In contrast, Go is a modern language build from ground-up to efficiently utilize the advantages offered by modern days multicore CPUs.
Yes, nowadays concurrency is hot and Go has built-in support for this feature at the language level!
A crude real life analogy could be, consider latest multicore processors as a Ferrari. Now the Ferrari has a capability to zip at a top speed of ~400 KM/Hr [~250 Miles/Hr] but will a normal city road support this speed? Unless you're driving on a motor racing circuit your Ferrari is as good as any other car. Hope you got the message :) if not please share a better analogy.
Traditionally Java, C# etc. addressed the concurrency
requirements by developing thread-based codes that are quite difficult and add
complexity to the application development. Go (Golang) has provided a simple and
efficient way to design software that can easily scale based on the system load
and underlying hardware.
As a beginner, I am yet to explore Go's concurrency aspect
but I must say that I am liking the language for its minimalist design. I'll
keep on updating this post as and when I learn something new about it.
I like Go for [in random order]:
- Minimalist design.
- Open source.
- Compiled - [better performance].
- Easier to deal with concurrent programming - built in asynchronous support.
- Statically typed [less error prone as you avoid runtime type errors]
- Go is fully garbage-collected.
- Clean syntax, no semicolons.
- Tidy, lesser number of brackets.
- Only one looping construct i.e. For Loop.
- This longer variable declaration var x string = "hello" can be shortened to x := "hello".
- Go release 1.4 [Dec 2014] supports Android - Yes, now you can write simple Android Apps using only Go code.
- As of Go 1.4 release Go compiler is written in C. But the team at Google, working on Go 1.5 is planning to remove all C programs from Go source tree. Go 1.5 compiler will be bootstrapped i.e. Go will use Go to build itself. Go version 1.4 will be used to build Go 1.5.
- Optional info: There are many programming languages where compilers have been bootstrapped, example includes, compilers for Java, Scala, Haskell etc.
- Many references on the web still say that Go is a System Programming Language - [i.e. it deals with operating system, device drivers & compilers etc.] - partially correct - as Go is now a general purpose programming language.
- Microservices - Yes, they are the future of web!
- IoT (Internet of Things) apps.
- --- ---
And you know what, Go is an excellent language for young school students and first time programmers.
Go is not only a good teaching language, it's an excellent one for first time programmers, including children. I want to try and outline the Go features that really stand out when you have young programmers and why I think we've ended up here.
Are you convinced enough to get started?
If NOT
Hope the above examples have already aroused your Golang curiosity to the Next Level.