I have had a hard time suggesting programming languages to beginning programmers, for a multitude of reasons. Most programming languages have gotchas that will trip up newbies and add needless frustation to their venture into making software.
In this article I want to evaluate the premise that Go is not only a big relief for wearied developers, but also does many things right that can benefit beginners.
Most programming languages have been around for a long time, accumulating design cruft and weird behaviors that don't make sense anymore. Explaining these to new developers takes time that could be spent better.
Go is not just free of cruft, it is also very well designed. Three designers, only adding unanimous features, lead to a language spec so simple and straightforward that it can serve as a reference. I have faith that Go will remain free of cruft in the future.
Having a useful standard library is important for beginners, because you can avoid introducing the whole new complexity of library systems and dependency management for a longer time.
While Python traditionally claims that batteries are included, the standard library does not hold up to that promise. Its parts are slow to adapt to the outside world, its APIs are far from best of breed and worst of all, sometimes do not even respect established Python naming conventions.
Go comes with well designed APIs for many of today's requirements:
If you are making a web application that does not need a database, the standard library has you covered.
Formatting and coding style
Programmers tend to spent an inappropriate amount of time debating trivial issues of coding style: should you use tabs or spaces, how many of those, where do the curly braces go, and if you like snakes or camels better. For a beginner, this means being chastised for doing it wrong. Often it means having to manually format the code, because more time has been spent on debate instead of a tool that can automatically format your code.
Ever tried distributing programs written in Ruby or other modern scripting languages? There are requiments on the correct runtime version, tools to install the correct version, tools to install library dependencies. These tools are valuable for experienced developers to keep control of their development and production environment, but understanding them is an impediment to beginners.
Go avoids most of the issue by generating stand alone binaries. If you are a beginning Go programmer, you can just mail your executable to your friends or your parents, as long as they run the same architecture and operating system. (Even if the arch and OS are different, cross-compilation in Go is amazingly easy.)
Everything about Go feels thought out and well made. This continues with the documentation:
- Interactive introduction into the language
- Regular posts on the Go blog explaining specific areas, like string handling, arrays and slices and code formatting
- Language specification that doubles as a language reference
- API documentation and examples for the standard library
I think Go is a great programming language that works for beginners and experienced programmers alike. Experienced programmers can appreciate the many things Go does right, while beginners can focus on learning programming instead of learning the warts of individual languages.Tags: