I’d been working with Node.js for many years and then with Go within my latest projects. I’ve been programming since 1992. I want to share what I learned about Go with you.
I’ll go into the details of each piece of information here in this post afterward, in the next posts. This post is here for giving you a quick overview of Go without going into the language-specific details and tutorials.
Go is an open source programming language from Google. Made its first stable release, 2011.
What does it mean that Go is an open source programming language?
Well, it’s created by Google as I said. However, even you can contribute to it by creating new proposals, fixing bugs, making it faster. It’s like a living being growing in front of you. If you’re curious, its source code ishosted here on Github.
Robert Griesemer, Rob Pike and Ken Thompson. They started designing Go language around 2007. Go language open-sourced in 2009. Read morehere.
Go design inspired from languages like Algol, Pascal, C, Modula, Oberon, Smalltalk and Newsqueak.
Go inherited mostly from Oberon language and its syntax is from C. Go’s OOP is more like Smalltalk but in Go, you can attach methods to any type. And concurrency is mostly from Newsqueak which is a language also from Rob Pike and heavily inspired by Hoare’s paper of CSP (Communicating Sequential Processes).
Fast languages like C, are difficult to work with and not safe. Compiling speed, dependencies and runtime errors are vast. An interpreted language like Ruby is safe but it’s slower and has many dependencies, one of them is the interpreter itself. Also, for Java, for example, a virtual machine is needed to run the code. Javascript and Node.js are wild kids; which are interpreted, weakly-typed and unsafe to work with (although there are some possible directions like TypeScript or compiling directly to Javascript from other safer languages).
Also, as an example, Java became too complex and verbose to write. There are many keywords which can be guessed from the context the language constructs inside in (which is called inferring). Ruby is joyful to work with however it’s not designed for speed in mind. Javascript lets you free, go wild and slowly kills you (maintenance nightmare, callback hell (the world before async await), no built-in solutions for safety).
For example, C language compiles very quickly, however, the language itself has not been designed to be compiled very fast (I’m not talking about the compiler here),so, C programmers can misuse the language facilities to create slow compiling programs. In Go, however, it’s been designed for fast compilation in mind from the beginning. So, it’s hard for Go programmers to create slow compiling programs as compared to other languages like C or C++.
There are at least half a million programmers in theGo community.
Most notable companies are Google, Docker, Dropbox, Heroku, Medium, Lyft, Uber,and others.
Also see:Go 2016 Survey Results.
Go has the cutest mascot ever. OK…, Let’s see the real advantages.
Go wants you to compose things not inherit like in other OOP langs.
go fmt
automatically rearranges your code for you after each save.go lint
makes suggestions to improve your Go code.$ go lint nocomment.go
nocomment.go:3:1: comment on exported function NoComment should be of the form "NoComment ..."
res, err := http.Client.Get("http://ip.jsontest.com/")// there are no try-catch exceptions in Go, check errors explicitly
if err !=nil {
return err
}// ...
Alright, that’s all for now. Thank you for reading so far.
Visual, concise and detailed tutorials, tips and tricks about Go (aka Golang).