Friday, June 4, 2010

Know programming language GO


Background

After the success of the browser chrome and the Google wave, Google re-create a buzz with the launch GO programming language.

Go is based on the C programming language family, one family of programming languages most used in the world. But what's interesting is combining the elements of Python (the language of choice in the development of Google) and Pascal / Modula / Oberon families to make faster and more dynamic program.

Go alone has the nature and syntax that is similar to its predecessor the C language, but with the advantages that are not owned by C, such as garbage-collectors, more efficient memory management and more. Google considers these creations programming language has an advantage over the speed, security, balance, fun and open source of course.

Currently the new Go is available for Linux and Mac OS X, and compilernya available in two types, each to the x86 64-bit and 32-bit. For those of you who want to try to directly install Go, they also provide tutorials for you can learn.

Go open source, so developers are free to develop it in accordance with market needs. Due to the existence of contributions from outside sources, this programming language will be better in the public eye, and with this reasoning is also widely known and Go can be used for sure.

A. Introduction to Go

Robert Griesemer, Rob Pike and Ken Thompson began sketching with the aim to create new programming languages on September 21, 2007. In a few days, sketasa has become a planning and design phase continues where part-time work. In January 2008, Ken has started his work on a compiler and he collected the C code as output. At mid-year, language has become a full-time project and at the end of 2008 Russ Cox was joined in a project and help to move the language and librarinya from prototype into a reality. Finally in mid-2009, Go was introduced to a general audience, especially for a programmer.

Go is a programming language that is open-source, where currently he is only just able to run on Linux and Max OS. Go offers an expressive type system, fast compilation, performance, and built-in features that simplify the programming languages and concurrency threaded.

B. Program Hello Word

Example program Hello Word!

main package

import "fmt"

func main () (

fmt.Printf ("Hello, 世界")

)

Files are stored on top with extension. Go, for example helloword.go. In the source code at the top is fmt, it is a package that implements the format for I / O. program starts in the main function, and printed by calling printf fmt package first.

Surely there Compiler for menjalankna this helloword.go program or to display output. There are two compilers Go, Go native compilers and compiler alternatives. Go native compiler, called 6g and 8G (for 64-bit and x86), designed to be very fast. And the alternative is compilers gccgo based on the GNU Compiler Collection (GCC). Example menkompile Go programs are:

$ 6g helloworld.go # compile; object goes into helloworld.6

$ 6L helloworld.6 # links; output goes into 6.out

$ 6.out

Hello, world; or Καλημέρα κόσμε; or こんにちは 世界

$

C. Basic Programming Go

Statement

There are many statements in the programming sequence, eg arithmetic statement, statement of function calls, statement printing, etc.. And most importantly, every statement, in programming Go must end with a semicolon (;).

Rows Comment

Rows of comment is used to write little notes in the program files needed by programmers to clarify progarmnya. Comment lines are ignored by the compiler at compile done. You are strongly encouraged to provide comments on the program so that the programs currently made could still be understood in the hereafter, either by you or other programmers.

There are two forms of comment lines, ie

1. Model / * * /

/ * This is a comment

This is a comment

* /

2. Double slash (/ /)

Usually, this model only to comment on the program with one line. Example:

/ / This is an example of one line comment ..

Syntax

There are differences in syntax Go to the previous language, let us take the C + +, we will compare the syntax Go with C + +.

Go C + +

var v1 int; / / int v1;

var string v2; / / const std:: string v2; (approximately)

var v3 [10] int; / / int v3 [10];

var v4 [] int; / / int * v4; (approximately)

var v5 struct (int f); / / struct (int f;) v5;

var v6 * int; / / int * v6; (but no pointer arithmetic)

var v7 map [string] int; / / unordered_map * v7; (approximately)

var v8 func (a int) int; / / int (* v8) (int a);

more, http://golang.org


CONCLUSION

Within a decade there has been no system programming language that leads to the changes that have occurred in the programming world. The changes that libraries and dependenci so much, focus on client / server, network, cluster and the rise of large multi-core CPUs. This condition is then forced the need for an efficient programming language, speed, secure, stable, fun and open source.

By combining the benefits of its predecessor and the addition of a programming language garbage-collector so as to reduce the need memory.menjadikan Go as a new programming language suitable to meet the needs of a programming language today.

Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 comments: on "Know programming language GO"