Thursday 27 April 2017

Go language and it's features

In past couple of years, there is a rise of new programming language: Go or GoLang. It is a free and open source programming language created at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. It is a compiled, statically typed language in the tradition of Algol and C, with garbage collection, limited structural typing, memory safety features and CSP-style concurrent programming features added.

But what kinds of projects are Go best for building, and how is that likely to change as the language evolves through new versions and grows in popularity?
1. Network and Web servers -
Network applications live and die by concurrency, and Go's native concurrency features goroutines and channels, mainly are well suited for such work. Consequently, many Go projects are for networking, distributed functions, or services: APIs, Web servers, minimal frameworks for Web applications, and the rest. Go programmers like that the items they use most in such projects are either a part of the language, such as goroutines for threadlike behavior, or available in the standard library like Go's http package.

2. Stand-alone command-line apps or scripts -
It's easy to put out simple command-line apps that run most anywhere. It's another echo of Go's similarities to Python. The executables created by Go are precisely that: Stand-alone executables, with no external dependencies unless you specify them. Another advantage Go has here is speed. The resulting executables run far faster than vanilla Python, or for that matter most any other dynamically executed language, with the possible exception of JavaScript.

3. Desktop or GUI-based apps -
Right now, the culture of software around building rich GUIs for Go applications, such as those in desktop applications, is still scattered. That said, various projects exist there are bindings for the GTK and GTK3 frameworks, and another intended to provide platform-native UIs, although the latter relies on C bindings and is not written in pure Go. Windows users can try out walk, and some folks at Google are in the process of building a cross-platform GUI library.

4. System-level programming -
While Go can talk to native system functions, it's not as good a fit for creating extremely low-level system components, like embedded systems design, kernels, or device drivers. Some of this is a by-product of the language's intentions, since the runtime and the garbage collector for Go applications are dependent on the underlying OS.

Even though Go is very different from other object-oriented languages, it is still the same beast. Go provides you high performance like C/C++, super efficient concurrency handling like Java and fun to code like Python/Perl.