Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
May 5, 2019 11:34 am

'Why I Prefer Go Over Python or Java'

Stefan Nilsson, a computer science professor at the KTH Royal Institute of Technology, recently explained "why I prefer Go to Java or Python," arguing that Go "makes it much easier for me to write good code."Go is a minimalist language, and that's (mostly) a blessing. The formal Go language specification is only 50 pages, has plenty of examples, and is fairly easy to read. A skilled programmer could probably learn Go from the specification alone. The core language consists of a few simple, orthogonal features that can be combined in a relatively small number of ways. This makes it easier to learn the language, and to read and write programs. When you add new features to a language, the complexity doesn't just add up, it often multiplies: language features can interact in many ways. This is a significant problem -- language complexity affects all developers (not just the ones writing the spec and implementing the compiler). Here are some core Go features: - The built-in frameworks for testing and profiling are small and easy to learn, but still fully functional. There are plenty of third-party add-ons, but chances are you won't need them. - It's possible to debug and profile an optimized binary running in production through an HTTP server. - Go has automatically generated documentation with testable examples. Once again, the interface is minimal, and there is very little to learn. - Go is strongly and statically typed with no implicit conversions, but the syntactic overhead is still surprisingly small. This is achieved by simple type inference in assignments together with untyped numeric constants. This gives Go stronger type safety than Java (which has implicit conversions), but the code reads more like Python (which has untyped variables). - Programs are constructed from packages that offer clear code separation and allow efficient management of dependencies. The package mechanism is perhaps the single most well-designed feature of the language, and certainly one of the most overlooked. - Structurally typed interfaces provide runtime polymorphism through dynamic dispatch. - Concurrency is an integral part of Go, supported by goroutines, channels and the select statement. The professor points out that the Java® Language Specification is 750 pages, and blames much of its complexity on feature creep (for example, inner classes, generics, and enum). And he also applauds the strict compatibility guarantees of Go 1 for the core language and standard packages, as well as its open source, BSD-style license, and Go's code transparency. "There is one standard code format, automatically generated by the fmt tool," he writes, arguing that "Your project is doomed if you can't read and understand your code."

Read more of this story at Slashdot.


Original Link: http://rss.slashdot.org/~r/Slashdot/slashdot/~3/Q9JmBRAFT2A/why-i-prefer-go-over-python-or-java

Share this article:    Share on Facebook
View Full Article

Slashdot

Slashdot was originally created in September of 1997 by Rob "CmdrTaco" Malda. Today it is owned by Geeknet, Inc..

More About this Source Visit Slashdot