Google Go – Will It Overtake Java as the Most Used Programming Language?
Google Go, or Golang, is the new programming language offered by tech giant Google. It’s open source, naturally, and is touted as being easy to pick up and learn and use, with a strong focus on systems programming and concurrency support, with very fast compiling times promised. We take a look at the ins and outs of the latest language to hit the market.
If you haven’t seen it yet, it looks somewhat similar to C, but has some curious syntax requirements. Blocks of code are required to be surrounded with curly braces, presumably in order to force consistency over code bases, and it uses case to specify visibility instead of keywords. It uses package-level visibility – other words, lowercase names like var foo are visible only from the current package, but uppercase names like var A are publicly visible. In Go, a name is exported if it begins with a capital letter (Foo is an exported name, as is FOO. The name foo is not exported).
Another curious aspect of Go is that type comes after the variable name in function declarations, as in the below example:
Go also supports, among others, two important new keywords – go and select, which are control keywords that have been introduced to support concurrent programming. Go’s built in support for channels and concurrency are a huge paradigm shift in the way programs are written. Some developers have claimed traditional C code designed for communications systems that would normally be 3,000 lines long can be reduced to about 250 lines in Go because you don’t have to worry about threads and syncing, mutexing, semaphores, or memory sharing.
Unlike C and Java, in Go line-ending semicolons are optional. This has caused a bit of a stir amongst the programming community – syntaxes without semicolons often strike fear and unease in equal measure into the hearts of developers – maybe because of bad experiences with programming over the Web and what that tends to do to whitespace. The syntax requirements of Go could be a mixed blessing – while some will definitely appreciate the standardized formatting that is mandatory with using Go, others will baulk at the thought of abandoning their long-established coding conventions. Indeed, many businesses have a house style already in place and might be a little peeved at having to adjust.
While Google touts the language as being ‘general-purpose’ – when you begin to critically analyse it, some doubt begins to cast over this claim. Not necessarily because of the lack of power of the language, but rather because such a small percentage of the developer community develop code that fully utilizes and optimizes processor performance. The vast majority of development these days is done in languages such as C# and Java, which offer Windows support and are extremely easy to jump into to code small tools with complex graphical user interfaces.
Languages such as C, which are essential for coding cutting edge software such as games, are only used by a small proportion of the population, and this is really the only market that Go might initially make a splash with. Because Go offers no Windows support, and has no IDE thus far with a visual user interface, it may struggle to make an impact amongst the more established programming languages.
However, one feels that if Google were ever to withdraw support for Java for their Android operating systems, and replace it with Go, which is a not-impossible scenario, then the popularity of Go would really soar. With Google’s recent court cases against Oracle, it’s been suggested as a possibility, albeit an unlikely one, and if it does eventually happen, what better way to get a huge head start on the masses by learning Go now? You can run through the initial tutorials at Google Code’s homebase here
Also take a look at the Google tech talk video on Go to get a better idea of the target audience for Go and what innovations it provides to the developer.