Site icon Geeknizer

Google Go: New Programming language

In the Era where we are surrounded by millions of programming languages, Google gives us a new GO.

Go is a new Open Source programming language from Google that aims at performance. The performance we are talking about is the fastest you can get: comparable to C minus the troubles and plus the ease. So what we get is more self-explanatory syntax and faster compilation.

Who doesn’t want more syntactic glamor, better runtime performance, better features, easier to code and faster compilation? Thats’s why we see so many programming languages.

Despite the large amount of enthusiasm, modern programming languages dont compare to C in performance. The best that Microsoft, Sun, and Apple have to offer are just variations on that theme.

Although Google’s Go is yet another take on object-oriented C, it’s got some nice features.

Go offers:

  1. An Expressive type system,
  2. Fast compilation,
  3. Great performance, and
  4. Built-in language features that simplify threaded programming and concurrency.

So how much effort did undergo for it’s development?
The GO has been under development for roughly two years. Like other most innovative projects from Google, it started out as a 20 percent project and evolved into a serious full-time undertaking.If youa re not aware Gmail, Google Earth, Google News and several other projects came from 20 percent of Google employee’s time which were later moved to mainstream.

So it’s Open Souce Where is the Source code?
Google is releasing the source code under the BSD license (and not GPLv2) with the hope that a community will contribute to make it even better.
How mature is the Language?

Rob Pike, a google Engineer, says that the Go language itself and the current implementation are relatively mature, but it’s not quite ready for adoption in production environments. The ecosystem around the programming language is still a work in progress. It lacks on several fronts like there is no IDE integration, the standard libraries are thin, and there aren’t a whole lot of real-world code tutorials, examples, debugging info yet. But liek any other open source project, Opening up Go could help to accelerate its advancement and hence adoption.

Compilers: Go comes with two native compilers: 6g and 8g (for 64-bit and 32bit), are designed to be extremely fast. There is an alternative compiler called Gccgo that is based on the GCC. As one would expect, the GCC-based compiler isn’t as fast but, on the other hand, is said to generate more efficient code. On the inside, compiler has a lot of LLVM expertise and is using it extensively for their awesome Python optimization effort.

The compiler generates native binaries, directly executable, no VM, no bytecode, and that’s what makes it faster and comparable to C.

Syntax: The syntax is very generic, hence easy to grasp. There assignments, functions, “for” loops, standard condition expressions, and many other features look easy. But there are certain tricks e.g. it has anonymous function syntax that lets you use real closures. The following code snippet is an example from Google’s documentation:

func multiply(a []int) int { // returns an int

m := 0;

for i := 0; i < len(a); i++ {

m*= a[i]

}

return m

}

m := multiply(&[3]int{1,2,3}); // am array is passed to multiply

It has some unusual type system: It stays away from inheritance. Instead, one can define struct types and then create methods for operating on them. Like Java, one can also define interfaces.The interface mechanism gives developers some of the flexibility of duck-typing, but it goes further by providing the advantages of compile-time checking.

Concurrency: One of the strongest reason to migrate to this language after all it`s taken care from the bottom up in the design. To simplify threading, it introduces concept of “goroutines” which are concurrently executed threads. Just like you would “run” in java, the function call with be “go” in Go language. The inter-thread communications, message handling is done through “channel” which Google calls  “safe” way of doing it while Going in or out of goroutines.

Watch the GO details in Google Tech Talk: (long one)

Do we Really need it?

This is the final and the most important question. Is Google re-inventing the wheel? Yes, google is doing it, but with a purpose. Go will take care of the major issues of today’s programming languages: Concurreny, multicore processing and efficient threading . But we need practical benchmark figures before we can go with that. On the other side,  it’s unusual type system is claimed to be very powerful.

Google developers, to convince us, have build the Web server software that powers the project’s official website. Possibly, that is the only PROD environment it will be seen on, atleast for some time. We really need some good experiences and stats before this language can catch the mainstream. And whenever it does, it might replace (atleast for few  people) C++.

Subscribe to Twitter updates, or RSS, join Facebook fanpage for more Tech updates.
Exit mobile version