Why Go Is A Minimalist Language
Recently, I wondered: What would be a good language for minimalists? A language that achieves more with less? A language that focuses on problem solving by hiding all those low-level tasks that some tool could do better?
Make no mistake: minimalism in programming languages isn't about the simplest language mechanics possible. A plain Turing machine is perhaps as simple as a language can get; yet, you won't get far if you set forth to implement anything meaningful by hand in “Turing machine language”.
It's also not just about language syntax and semantics. Minimalistic software development aims at achieving maximum results with minimal resource use. For instance, tasked with architecting an API service with a database and a caching layer, a developer might choose PostgreSQL and Redis—two typical choices, right? And following the old (and outdated) saying that “nobody gets fired for buying IBM” (when IBM was the go-to seller of PCs and office machinery), developers are quick to think, “nothing's wrong with choosing PostgreSQL and Redis.”
However, had they analyzed the problem a bit closer, they might have discovered that the service requires no database server and only a fraction of Redis’ capabilities. They might then decide to use SQLite and a native Go caching package (or maybe even just in-memory SQLite), and—poof!—the need for setting up and maintaining two additional servers evaporates.
Or think of the developer who uses Kubernetes for building any software stack, even when a simple systemd solution would be more than enough.
This is the kind of minimalistic software development I'm talking about. And minimalism also means to be able to focus your energy on the problem rather than language peculiarities or automatable tasks like memory management. A language for software minimalists doesn't stand in the developer's way.
So let me come to the point: I think Go checks quite a few boxes in this discipline.
As a language for minimalists, –
- Go apps require no pre-installed runtime, no virtual machine, even no system libraries to run
- Go has a small core language with a simple (but not simplistic) syntax, fostering fast learning and easy reading of code, especially others’ code (because you read code much more often that you write it)
- Go has a very efficient garbage collector that moves the tedious work of managing memory allocations and deallocations off your shoulders—the last thing you'd want to create and maintain is a codebase that continually concerns itself with memory management
- Go comes with a rich standard library that reduces the need for third-party libraries—fewer dependencies mean fewer places outside your control
- Go has a feature-rich toolchain that covers all development tasks from compiling and building to testing and dependency management
- Likewise, turning source code into a binary requires
- Go said “thanks but no thanks” to inheritance at a time virtually everyone (except the FP folks) considered OOP the peak of programming language evloution; now it has proven for years that inheritance (with all of its complications) simply isn't required to build great software
- Go intentionally forgoes method overloading and operator overloading, to greatly reduce the magic of source code
- Go has no macros and no metaprogramming (boy, I once had the “honor” to look at some heavily obfuscated C code that was half C and half macros. Instantly, I knew that the programmer who created this had drastically reduced the chances of getting fired, because who else would understand such code in their sane mind?)
- Go ends the source code formatting war with
gofmt
and the formatting rules that come with it. As a Go proverb says, “Gofmt's style is no one's favorite, yet gofmt is everyone's favorite.”
Some of these aspects may seem minor, but summed up, they make Go an ideal language for minimalist software development.