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…)
 

6 comments:

  1. Thanks for the insightful article. Looks like, it's time to learn a bit of go.

    ReplyDelete
    Replies
    1. - Hey thanks, Amey, for those warm words of appreciation! For sure, there's no better time than now to learn a bit of Go :) :)

      - It's been said (and here I am paraphrasing *Alan Perlis from memory) that a language that does not change the way you think is not worth learning. I can assure you that Go will change the way you think, at many levels, not just one...

      - And here's the thing: In the brief span of this essay, I didn't even mention higher-order functions (HOFs) and goroutines (I can say, though, with the feeling of relief, that I definitely did talk about channels for crying out loud!).

      - So dig in and have some fun: Go will change the way you think...

      - There came a time when I was telling a friend (one of the most accomplished and finest software designers on this planet, and who, knowing me well, was keen that I look into the Go programming language) that I already know more languages that I know what to do with!

      - Boy, was he right, and I should really have listened to him earlier! Go is one smashing gem from the minds of some leading language designers, practitioners all, in-the-trenches guys all!

      - Again, thanks for those warm words of appreciation, and I will leave you (for now) with this thought another eminent programmer and hacker with roots in the UNIX world... It is Eric S. Raymond who memorably reminded us, back in the day, that:

      "Lisp is worth learning for the profound enlightenment experience you will have when you finally get it; that experience will make you a better programmer for the rest of your days, even if you never actually use Lisp itself a lot."

      *Alan Perlis was an American computer scientist and professor at Yale University who is perhaps best known for his pioneering work in programming languages. (By the way, he happens to be the very first recipient of the Turing Award, so you had better listen up when the professor is talking!)

      Delete
  2. good stuff as always Akram. We are doing a post on EdgeX Foundry soon about "Why use Go" and some of this serves as great background and food for thought.

    ReplyDelete
    Replies
    1. - As always, delighted to hear from you, Jim. I appreciated your warm words of appreciation, and please know that the pleasure is all mine: It's a profound privilege to share with my readers what I have discovered, and continue to discover, about our endlessly fascinating industry, it's technologies, and what truly makes our industry tick!

      -That is awesome, and I couldn't be more delighted than to learn that my most recent essay (this one) will serve as background and food for thought for your upcoming post on EdgeX Foundry. My very best wishes. I'll stay tuned for the appearance of your post on the effectiveness and applicability of the Go programming language ("Why use Go")!

      - Two parting thoughts for now:

      (1) As a fellow technologist who works for a world-class company that's leading the Internet of Things (IoT) market in telematics, I have the luxury of seeing from a vantage point that the future of our world will squarely revolve around IoT even more so than it does today: Predictions, predictions, predictions...

      (2) We technologist have to put our heads together and do IoT right so we can delight our customers the world over!

      - On a lighter note, I will share with you and other readers a recent experience (with IoT devices) of another good friend of mine (Edward A. Lee, who is the Robert S. Pepper Distinguished Professor in the EECS department at the University of California at Berkeley). An absolutely brilliant individual and an expert in the area of IoT, Professor Lee has entertainingly articulated his recent adventure with a programmable "...thermostat [that] starts dancing to its own drummer and invents its own schedule." More details at his University of California at Berkeley page: I wanted a thermostat that...

      - Coincidentally, and this may come across as a shameless plug for my blog (which I would like to, ahem, think well of if I could), while you and other readers are at it (i.e. reading up on Professor Lee's recent adventure with his programmable thermostat!), I invite you to also read up my three-set series of essays (right here on this blog) with the coordinates to be found on Professor Lee's homepage for his book that was published last year by The MIT Press as follows: Reviews of Plato and the Nerd (The MIT Press).

      Delete
  3. very nice..post.
    https://shayarihindishayari.com/

    ReplyDelete
    Replies
    1. Thank you very much, Rani, for sharing your gracious and candid thoughts on this post - I'm glad you enjoyed the essay!

      Delete