19. November 2014
Recently, a friend asked why did we choose google's Go in our R&D lab instead of Python or even Nodejs. In this post, I will outline the motivations behind our decision and maybe help convince others to explore Go by exploring the language features starting with the most appealing ones from developers and business points of views.
Why use Go?
- Google released, and open sourced go under the DBS license in 2009.
- With 25 keywords, Go is a straightforward language to learn and be productive in a very short time. It is the only language that I know of that you can learn by writing go on phones and tablets (check out https://play.google.com/store/apps/details?id=com.termux)
- Concurrency is built into the language. goroutines are cheap and efficient in their utilization of the stack; they will grow the required stack when the application needs it. Go's concurrency is built on the Communicating Sequential Processes language.
- Go compiled to machine code, no IL, interpreters or virtual environments.
- goroutines (see point 2) and OS threads do not have one to one mapping. A single goroutine can run on multiple threads. Goroutines are multiplexed into a small number of OS threads.
- Go compiles to a single executable for very easy deployments, supports static linking so you can distribute one binary, all the libraries you need, and all of your compiled code, and it is strongly statically typed with a compiler that flags many classes of error.
- Go promotes composition over inheritance; structs and interfaces replace classes in the language.
- No dead code, the compiler will fail to build your code if it contains unused variables. The compiler will make you honest.
- Ryan Dahl, the creator of Nodejs, recommended using go instead of Nodejs(https://www.mappingthejourney.com/single-post/2017/08/31/episode-8-interview-with-ryan-dahl-creator-of-nodejs/).
- Google has done a fantastic job documenting the language (https://golang.org/doc/)
Who uses go?
Docker & kubernetes, Twitter, Netflix and of course google.
Go learning resources:
- Documentations- https://golang.org/doc/
- Playground - Browser based playground where you can share your code with others to review or learn from https://play.golang.org/
I hope I have given you a reason to try get up and Go :-) (cheezy eh?)