Go is a Google created
programming language that can be used as an alternative for C/C++. The syntax and design of the program is
designed for system programmers. It
exhibits built in concurrency and garbage collectors which is missing in
C/C++. As of the moment, this
programming language is still rapidly being developed.
Go enables users to build
a CMS and generates HTML pages. As an
example, the Golang.org site is made from this language.
Programmers who were able
to use system languages had a positive experience with this language. It is simpler
than C++, more adaptable than Java, has an extensive well designed library and
provides the services required to Web applications, such as WebSocket,
closures.
Features
- No
semi-colons required but to separated statements.
- map is a hash table and is part of the language.
- Multiple
threads that communicate with each other.
- Variables
are declared as in Pascal:
var name type
Ex: var x int; - Functions
can return multiple values at once.
- There
are no parentheses around the conditions in if or for as
in Scriptol.
- break and continue may specify a label.
- The switch case structure may include different
types or comparators as in Scriptol.
- A case statement
can contain several alternatives:
case 0, 1, 2: - A slice is
a structure that includes a part of a list and point to it.
- The Go command
calls a function by starting a different thread.
- chan is a channel for communication between Goroutines (which are
functions of concurrent threads).
- UTF-8 format for strings.
Difference with C++
Even
if it uses a syntax of the 70s, Go simplifies a lot programming compared to
C++.
Many common causes of errors coming from the syntax are removed.
Multi-threaded operation becomes quite easy thanks to a single command.
The garbage collector avoids memory management by the programmer.
Many common causes of errors coming from the syntax are removed.
Multi-threaded operation becomes quite easy thanks to a single command.
The garbage collector avoids memory management by the programmer.
- There is no class and inheritance. The interfaces are close
to objects of JavaScript.
- Memory is managed automatically by a garbage-collector.
- Pointers have a type set.
- Arrays are passed by values and not pointers.
- Imports of packages as in Java rather than headers.
- No type conversion without using a function.
- nil replaces null.
- The pointer symbol -> is replaced by dot.
- No do while.
- No break in the switch case (as in Scriptol).
- Increments - and + + can not be used in expressions.
- Constants can be declared without a type.
- new is a function and not an
operator.
Go vs. Java
Java
was designed as a language for the Web and became popular thanks to that. It
can run on the server or the client with applets.
Its
main advantage is its huge library to build graphical user interfaces.
Go might adopt a different approach, using Webkit to the interface, Native Client or be integrated into the browser as JavaScript to run Web applications on the desktop.
Go might adopt a different approach, using Webkit to the interface, Native Client or be integrated into the browser as JavaScript to run Web applications on the desktop.
Go vs. C #
C#
was created by Microsoft as an answer to Java and is designed to run on the
.NET platform. The platform suffers from a lack of compatibility. It runs on
Linux, but with reduced features compared to the version of Windows.
C#
also works in Silverlight for Web applications.
Name Issues
Go Had name controversies
because another programmer claims he already used the word Go! for his
programming language that has been written on a book entitled “Let’s Go”. But that got cleared because it has been
clarified that this programming language is named Go not Go!.
There is even a joke
about possible debugger to be named “ogle” as mentioned in http://www.theregister.co.uk/2009/11/11/google_go/.
Sample
code
Hello
World! program:
package main
import fmt "fmt"
func main()
{
fmt.Printf("Hello, world\n");
}
Displaying chars of a string:
package main
import ("os";"flag";)
func main()
{
var s string = "Demonstration";
for i := 0; i < s; i++
{
os.Stdout.WriteString(s[i]);
}
}
The lack of parentheses after the for is voluntary.
COMMENTS:
Douglas Fils said :
Go "feels" like a dynamically typed language, says
Fils, but Go provides static typing that is "not heavy like Java."
The garbage collection in Go, is "much better than the JVM." Says Fils,
"I don't have nearly the issues with memory in Go as I do in the JVM.
Especially when compared to a dynamic language like Groovy."
"With JVM-based apps I feel like I
am always becoming a system administrator, not a developer. I'm modifying heap
spaces, working on load-balancing or memory issues or other resource
management. With Go I'm not running into that. I develop, compile, test, run,
deploy and enjoy."
Sir Jach said:
Me: “Sir ano pong magandang ibang programming
language?”
Sir Jach: “Un Go ng Google mukhang magandang
language.”
Me: “OK naman po ba ang implementation nun?”
Sir Jach: ” Mukhang OK naman un.”
For short: “Go is a promising language. I
believe it is OK.” – Sir Jach
“In my opinion, Go can be a good alternative for system programmers, with its built in functions, it can definitely make a programmer’s life easier and lighter. This programming language also has a great possibility of being rapidly improved and implemented because it is based on the widely used programming languages like C, C++ and Java.
There are also people who do
not like this language. They said it
will is more fr multiprocessors, some of the features are already in Java and
C, and mainly the negative comments are more on single specifics only. But we cannot ignore the fact that the
marketing of this programming language is so intense that developers are also
trying to implement this already on Unix systems. And If I were to become a
system programmer, this language would be a good choice since it lessens my
tasks and there will only be few adjustments in putting the lines of codes
together.” - Diosah
Reference/s:
No comments:
Post a Comment