Sunday, April 8, 2018

The Go Programming Language

0 fAn important scientific innovation rarely makes its way by gradually winning over and converting its opponents: it rarely happens that Saul becomes Paul. What does happen is that its opponents gradually die out and that the growing generation is familiarized with the idea from the beginning.
~ Max Planck (in The Philosophy of Physics)

Preamble 🚧

It rarely happens that one comes across a programming language that takes your breath away, a language that gets you all excited, and one to which you warm up from the very get-go. And what might that language be? Allow me to introduce to you the Go programming language.

Quite a bit has already been written about Go, of course, so this essay does not rehash any of that. Instead, we are going to have some fun peeking into some of the coolness that Go has to offer!1 fMuch as I said earlier, quite a bit has already been written about Go. In fact, the definitive book on Go—in the grand tradition of the C programming language—has already been written. That Go beauty happens to be the book in the postage stamp picture above:
The Go Programming Language (Addison-Wesley Professional Computing Series) by Alan A. A. Donovan and Brian W. Kernighan.
You simply cannot go wrong by starting out your Go adventure with the Donovan and Kernighan book—yes, it is that good!
2 fA great second book would be the one you see in the postage stamp picture above:
Concurrency in Go: Tools and Techniques for Developers (O'Reilly Media) by Katherine Cox-Buday
Now for a bit about some of the coolness Go has to offer! If you are ready, take a look at the "furry" and stodgy mammal in the picture below and ask yourself this question: Would you like your programming language—the one you use on a daily basis—to be equally stodgy?

(Scratching my head as I was, I still haven't come up with quite the analog for what “furriness” would look like in a programming language, so we will treat this particular aspect of the subject as an open-and-shut case. But stodginess, yes, I think we are clear there!)
3 f
If you’re still with me, I want you to ask yourself this follow-up question: Would you like your favorite programming language to resemble the bulky, lumbering creature that is the rhinoceros? (Please see the exhibit below for a fine specimen of said monumentally bulky species…)4 f
And in the remote case that you’re still with me—I typically don't ask half as many questions as I've done today—I have one final question for you to ask of yourself: Would you rather not have your programming language—the one you would like to use on a daily basis—to be as featherweight as the butterfly in the postage stamp picture below? If you answered "Yes" to this question (and "No" to the previous two), then you owe it to yourself to check out the Go programming language: It sure has a lot going for it, and, in turn, for you!5 f
Ah yes—and hey, who am I to ask the Koala bear below to wipe that smug smile off its face—programming in Go can take you to the top of the world, notwithstanding the Koala bear or two you might run into along your way, perched as they already are at the top of the world, also evidently hanging on for dear life!6 f
But you may well be asking: Has the accompanying Go infrastructure, the bridge—the one that will eventually take us from here to there—been built, or are we merely looking at the hulk of some forsaken jetty such as the forlorn one in the picture below?7 f
Well, I've got some really good news for you, such as: As a programming language, Go is rock solid, and libraries are being added at a furious pace everyday. Ever single day! The developments in this fecund field are dizzying, so hold on to your hats, yo 🎩a

Needless to say, Go is an awesome addition to modern programming languages such as Scala.

8 f
Let me also assure you that it is not a bridge to nowhere. Most definitely not, because it's a  bridge to somewhere, somewhere really good! Take it from someone who has not only been designing and developing distributed applications for ages, but also one who got his start in the programming industry by using the C programming language on a daily basis (at his first job straight out of graduate school) πŸŽ“

Guess what? Go is “C for the 21st century”, and then some!9 f
Let's cruise around that nexus, that very connection—that Go is “C for the 21st century”—and explore it a bit πŸ”­

Heading over to the Donovan and Kernighan book, check out when the learned authors rightly point out:
Go bears a surface similarity to C and, like C, is a tool for professional programmers, achieving maximum effect with minimum means. But it is much more than an updated version of C. It borrows and adapts good ideas from many other languages, while avoiding features that have led to complexity and unreliable code. Its facilities for concurrency are new and efficient, and its approach to data abstraction and object-oriented programming is unusually flexible. It has automatic memory management or garbage collection.
The Go Programming Language
(Addison-Wesley Professional Computing Series) by Alan A. A. Donovan and Brian W. Kernighan.
So there you have it. Hold on to your hats: Go has a bunch of tricks up its sleeves, tricks almost magical—remember Arthur C. Clarke’s dictum that any sufficiently advanced technology is indistinguishable from magic—but they’re all very cool, very powerful 10 f
What makes Go especially cool is that it’s very core—we live in a multicore programming world  although the pun here was totally unintended—is inspired by the notion of communicating sequential processes (CSP) which originated in Tony Hoare’s 1978 fabulous white paper, the gist of which was the following: programs are parallel compositions of processes that have no shared state. Instead, all processes communicate and synchronize via channels πŸ“¬11
Composing larger solutions out of smaller ones makes solving problems easier. A whole lot easier! And that’s where Go’s channel primitive shines. Think of a Go channel as an honest-to-goodness construct that gives you a composable, concurrency-safe mechanism for communicating between concurrently-running processes πŸš… πŸš… πŸš… πŸš… … πŸš… 12 f
See the beautiful bridge above, built as you can tell by workers having laid one plank after another? That composability for you: In the programming world—once you get comfortable with Go's channels—you'll find yourself reaching all the time for this remarkable construct to build bridges that will take you from here to there.

In some ways, I'm reminded of software actors, but that's another story πŸš€13 f
One more time—rest assured that we are not going meta again with anthropomorphizing as we did earlier with stodgy mammals, a lumbering rhinoceros or two thrown in there for good measure, featherweight butterflies, plus those adorable Koala bears—let’s take stock and ask ourselves: Surely we want a programming language (thinking here to the C programming language) with vintage pedigree?

Speaking of vintage stuff, check out the vintage model below… Hey, it's a Chevy too!15 f
Or… Let's put this another way: Would you rather not go for a ride with a language that has the gravitas—not to mention the power, speed, and acceleration—of the Chevy Corvette below?

Okay good, no need to belabor the point. Point made ⛳16 fFor my money, the Go programming language sure smells like the roses!

17 fPostscript πŸ™

Hey Akram, by the way, hi after the hiatus. Like, where have you been lately? Playing Go or something? (And hey, that sure looks like your Go setup below!) I mean, we didn't hear a peep out of you around our digs here for nearly four weeks for crying out loud.

(More questions to follow for yours truly…)