Why Go!

First of all, why Go?
Go was created in 2007 at Google for following reasons
Slow Compilation: C++ and Java code at Google was too slow to compile. They needed something that could compile quickly
Complexity: Existing languages had grown to become too complex. They needed something that’s simple.
Concurrency: Languages such as C++ and Java made concurrency hard to manage.
Go brought some advantages as well
Tooling: Go has great tooling support (fmt, go test, go doc)
Garbage Collection: Go’s GC makes memory management simplified.
Goroutines: Light weight threads with multiplexing.
So did Google replace all its code with Golang?
The answer is NO!
Many of the languages (specifically Java) that were complex and that didn’t supported features such as concurrency, now they do, and they have pretty much simplified things.
So why Go?
Because Go is still different. Go needs minimal setup over general purpose languages like Java. Go is still fast to compile, faster to execute and fast to ship.
If you compare Go with scripting languages like Python and Javascript / Typescript, these scripting languages did offer rapid prototyping since the beginning. Go still has advantage over them because of concurrency.
If you compare Go with C++, the basic reason of using C++ was speed. However Golang is able to deliver the speeds relative to C++ with additional features and a different programming paradigm.
So Go is best of both worlds and hence you should be using Go.
Today, Javascript tops the charts because of it being heavily used by browsers and in web development. Java dominates the MNCs and legacy setups. Python dominates the AI space as well as backend. Go is slowly catching up being relatively new.
Go sits right between Java, Python, Javascript and C++. Go is a multi-paradigm (Imperative, Concurrent, Procedural) programming language.
Composition is a core philosophy of Go. Composition is basically building complex behavior by combining simpler types or functions. Composition is an alternative to Inheritance where you would combine multiple classes to create a complex behavior.
Go suggest instead of creating hierarchies of classes, just compose small reusable pieces of code.
type Animal struct {
Name string
}
func (a Animal) Speak() {
fmt.Println(a.Name, "makes a sound")
}
type Dog struct {
Animal // embedded
Breed string
}
In next topics, we will cover how we can use Golang to create highly scalable applications.
Subscribe to my newsletter
Read articles from Sankalp pol directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
