Go: New Open Source Programming Language from Google



Go is a new programming language from Google that aims for performance that is nearly comparable to C, but with more expressive syntax and faster compilation. What it won't do, however, is liberate the coding masses from bracist tyranny. Google's Go is yet another take on C.

The language is called Go, and it was released under an open source license Tuesday. Google is no stranger to the open source world. The company has released the underlying code for several of its tools and services under open source licenses over the years. Just last week, Google released its Closure JavaScript tools for building Ajax web apps. And now Google has considerably upped its investment in free software with the release of Go, which is an entirely new programming language.

Google never seems to just be satisfied with the status quo, and when they run out of fields to compete in they create their own! Google’s new “Go” programming language is one of their newest ventures, a language which is an amalgamation of Python and C++.

The Go language, in development since September 2007, has been unveiled by Google along with the release of a free and open source compiler. In fact, Google has released both a stand-along compiler implementation with cryptic names such as 6g (amd64 compiler), 8g (x86 compiler), and 5g (ARM compiler) and one which is a front-end for GCC (gccgo).

Born out of frustration with existing system languages, Go attempts to bring something new to the table, and mix the ease of dynamically typed and interpreted languages with the efficiency of compiled languages.
At first glance, Go looks a bit like C++, but borrows some elements, such as garbage collection, from scripting languages like Python and JavaScript. But Go’s real standout feature is its speed. A demo video shows the entire language — over 120K lines of code — compiling in under 10 seconds.

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 why make a new programming language?

Google believes that the current languages have run their course. The prominent languages in use today (C/C++, Java, C#) are all based around a similar syntax, and updating and adding new features in these language consists of piling on libraries, with little or no upgrade to the core of the language itself. What Google intends to do requires more than just the addition of a new library.

Hello World in Go

package main

import "fmt"

func main() {
fmt.Printf("Hello, ??n")
}
The landscape of computing has changed a lot since C, and as Google notes “Computers are enormously quicker but software development is not faster.” Languages have had to morph quite a bit to take on support concepts such as parallel processing, and garbage collection.
Go, on the other hand has been designed by Google from the ground up as “a concurrent, garbage-collected language with fast compilation”.
In order to not alienate the majority of developers though, its syntax is quite similar to C, and would not take much time for a developer to catch on to.
Go has accomplished some impressive feats. The language is designed to compile fast and Go can compile a “large" program in a few seconds on a single computer. It is designed to simplify the creation of application which can better utilize today’s multi-core processors. The language supports concurrent execution and communication between concurrent processes natively, and is fully-garbage collected.
Goroutines allowed are Google’s answer to threading in Go, and any function call which is preceded by the go statement runs in a different goroutine concurrently. A feature called channels allows for easy communication and synchronization between such routines.
Unlike other object oriented languages, Go has a much “simplified” type structure, which disallows sub-classing! Go offers a different flavour of object oriented programming using interfaces, which Google believes will simplify use.
By using interfaces, explicit type hierarchies need not be defined, instead, a type will satisfy all interfaces which are subsets of its methods. The relationships between types and interfaces need not be defined explicity! This can have some interesting implications as people can add interfaces to connect unrelated types even later in the development of an application.


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.

Go seems inspired by Python as well. Python has been one of Google’s favoured languages and was the sole language supported on Google’s AppEngine when it launched. Like Python, Go supports “slices”, which allow you to refer to parts of arrays using a simple syntax. Thus for an array “a” with 100 elements, a[23,42] will result in an array with elements 23 through 42 of a. Go also tracks the length of arrays internally, further simplifying array usage. Additionally, Maps in Go allow you to create “arrays” with custom index types, and are a native feature of the language.

“Our target was to get as close as we could to C or C++,” said Rob Pike, a principal software engineer working on Go. “They’re reasonably close–programs run about 20 percent to 30 percent slower right now.”
One consistent point in the features of Go is that it is better to have one excellent implementation of commonly used features such as garbage collection, strings, maps etc. rather than have them rethought and re-implemented in each program.

Google says that Go takes full advantage of modern, multicore hardware; that it simplifies dependency analysis and avoids the overhead present in C-style languages (such as files and libraries); that Go's type system has no hierarchy, which saves the programmer from having to define relationships between types; and that Go is fully garbage-collected and naturally supports concurrent execution and communication.

Final Words :

As nearly all Google products, Go is “beta” and not yet suitable for production use. By releasing it early Google hopes to garner a community around.

Offering a new open source programming language is not a big jump for Google. They already have their own Chrome browser and Android mobile operating system. There are even plans to offer a Chrome OS (GCOS) for netbooks some time next year. Like Android and the upcoming Chrome OS, Go’s success will rest solely on the shoulders of developers who choose to use it.

Of course, it's way too early to predict the impact of Go on programmers or programming. But we have a feeling that in this way, as in so many others, quite a few people will fall behind Google and look at this as a convenient way of writing programs for modern hardware. If it won't spell the end of the various programming languages in common use, it will undoubtedly represent at least the start of a major C change.





Get Tech Updates via eMail :

1 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete

 

About Tech Guru

TechQuark
TechGuru is a leading technology site, dedicated to software, gadgets, tech news and reviews. The site offers articles, tutorials and how-to guides on all things related to personal technology, desktop applications, productive online tools, social networking sites, windows, office etc.

Founded in 2007, TechGuru features audience who have the passion for Software and Technology and seeks to promote awareness about the internet and computing.

Get News on the Go

Mobile TechQuarkTech Guru is a mobile-friendly website. Simply bookmark m.techquark.com in your mobile browser for free access anytime, anywhere.

Contact Us / Send a Tip

Use Contact Form, if you have Comments, Problems, Suggestions, Praise, Complains about the site. Your suggestions and articles are valuable to us.

Copyright © 2007- Tech Guru - All rights reserved. No part of this blog be republished or written without prior permission of the author


Privacy Policy | Disclaimer | Contact | Advertise With Us


Designed and Maintained by Shubham Gupta