Go for Rubyits — Part 1
Ok, Go. So what?
So have you heard? In July 2017, The Golang made it to the top 10 TIOBE’s programming languages rank. Does it tell us anything? Well, while many might say it doesn’t, I find it interesting and it’s also an incentive (at least a good excuse) to invest time into learning the language and its tooling. In the last 2 years, Go has been on my radar. I’ve heard so many good things about its design, features, community, and how it has become a go-to programming language for large numbers of software engineers, helping them solve problems across different domains.
Why is Go an interesting language?
As I started to research about Go, I noticed that some words kept appearing repeatedly, here are a few of them: performance, multi-cores, concurrency, low-level, compiled, statically typed, cross-platform and generics (not really… Lol).
We’re going to cover these topics further below, in this section I want to briefly point out some of the reasons why I think Go is worth your attention.
Go is backed by Google.
Rob Pike wrote a very comprehensive article explaining why Google thought it would be a good idea to create a new programming language.
The Go programming language was conceived in late 2007 as an answer to some of the problems we were seeing developing software infrastructure at Google. The computing landscape today is almost unrelated to the environment in which the languages being used, mostly C++, Java, and Python, had been created. The problems introduced by multicore processors, networked systems, massive computation clusters, and the web programming model were being worked around rather than addressed head-on. Moreover, the scale has changed: today’s server programs comprise tens of millions of lines of code, are worked on by hundreds or even thousands of programmers
According to Russ Cox, in his talk “A Tour of Go” , the primary motivation to write a new language was to create something that could handle the scale of programming Google has — both in the number of lines of code and in the number of people working in the codebases. Plus, Russ also mentions that the language was created with other things in mind, such as providing a better support for connectivity between distributed systems.
Before reading Rob Pike’s article, have you ever wondered how many software engineers work at Google? How many systems, in all levels of complexity, do they run and maintain? How do these systems interact with each other? How about the non-functional requirements, such as resilience, availability, scalability that they have to meet?
I can’t fully answer these questions myself, but what I think we can do is list which qualities a programming language should have in order to tackle these challenges.
So, Google has “large numbers of software engineers” and “a lot of lines of code”. What does that tell us? Well, maintaining a codebase is more about reading than writing. Since we read to understand the context, it’s safe to say that in order for a programming language to solve the “large numbers of software engineers and a lot of lines of code” challenge, it needs to be expressive, documented, concise and to provide a rich standard library. Systems can differ from each other in many ways, some have IO bound characteristics, others tend to be CPU bound while others “whatever” bound, running many of them is a challenge that requires IMO, a general purpose language capable to perform properly in different scenarios providing a good way to manage dependencies and adequate tooling to assist an engineer from the first line of code to debugging, compiling, profiling and delivering the program.
Last but not least, the language itself should welcome newcomers, abstracting complexity by promoting a short learning curve, fun and productivity.
Many words, right? is Go already there? I don’t know, you be the judge! Bear with me till the end of this article and let me know your thoughts.
Minds behind the Go programing language
It’s known that Google employs outstanding engineers, so when I heard Google had created a new language I was sure it would be something well designed. By the time this article was written, the Golang project had 911 contributors on github, but there are two names you will often see when researching Go, these names are: Ken Thompson and Rob Pike.
Ken Thompson (B[on] -> C, Unix, UTF-8, Plan9)
Creator of Unix, Space Travel game, Plan9 and the language B (predecessor of C). It seems like Ken Thompson, along with Rob Pike, came up with how to implement UTF-8 in one night (impressive huh?). Check out the full history here.
Rob Pike (Unix, UTF-8, Plan9, Inferno, Acme text editor)
Like designing and implementing Plan 9, Unix, UTF-8 weren’t enough, Rob Pike also worked on the Inferno operating system and created the Acme text editor which seems to be Russ Cox’s favorite editor.
Ok, I guess at this point you agree with me that the Go’s credentials are impressive. But, before we go ahead and talk about how a Rubyist can learn and became productive with Go, I would like you to meet Glenda.
Can you see the similarities between Glenda and the Go Gopher? Yeah! Both Glenda and the Go gopher, were created by Renee French. For more information check this out.
How is Go different from Ruby?
Go is an open source, compiled, concurrent, garbage-collected, statically typed language developed at Google.
Ruby is an Object Oriented, dynamic, and open source programming language with a focus on simplicity and productivity created by Yukihiro “Matz” Matsumoto.
As I see, the main differences are:
Go
- Compiled
- Statically Typed
- No support for Subclassing
- Strongly Opinionated
- No support for Exceptions
Ruby
- Interpreted
- Dynamicly Typed
- Fully supports Object Oriented Programming
- Flexible
- Supports Exceptions
In the next parts we are going to dive into the Golang world to see how we can get things done! See you soon!!