By Iman Tung
One of the advantages of working with a nimble start-up like GO-JEK is, we get to tinker around with a lot of programming languages. We went with a microservices architecture early on, and that has helped us immensely. Which got me thinking — among the 3 most chosen languages, which one is better for microservices? Is it Ruby? Java? Golang?
None. For now…
It goes without saying, the choice of language and architecture design is extremely subjective and is based on knowledge, experience and preference of a developer. Every programming language has its own pros and cons. Golang, for example, may be powerful, but will you choose it if you’re the only one who can write Golang code in the whole team? We must consider people, the learning curve, team culture and project needs before choosing a tech stack.
How do you choose a language?
Disclaimer: This is my personal opinion of java/ruby/go without any intention to disregard a specific programming language. By nature, it’s impossible to defend or attack any language — and therein lies the beauty of programming.
Programmer’s best friends ~Rubyist
The reason I started using Ruby is because of the Ruby on Rails framework. This framework offers convention over configuration saving time and effort, because developers don’t need to decide the more mundane aspects of development. Rails has a clear standard on how to organise files, testing, handling databases etc. One doesn’t have to write code from scratch, instead one can use scaffolding to generate code, and then edit the few lines that are relevant. Development is fast and it’s easier to apply TDD and rotate a programmer to another rails project.
Ruby is designed to focus on the feeling of writing code and probably the easiest programming language to read. However, it’s relatively slow, and doesn’t support real multithreading. In this regard, using JRuby is a better option than Ruby MRI.
Ruby on Rails is designed to develop web application based on best practices (rails conventions), so it might be tricky if you need to make custom configurations or something different with the conventions.
Ruby on Rails is a great choice for developing simple portals or RESTFul services in a short time. But it’s not the complete package for rather obviously glaring reasons — not every problem is solved by a RESTFul web application.
A Programmer had a problem. He decided to use Java. He now has a ProblemFactory. ~Java Joke
Java is object oriented and a mature programming language. Most developers are familiar with this beast and it’s still the industry standard for programming languages. It’s definitely the most supported language in the open source community, more so on the Apache community. Many languages have touted to spell doom to java and yet, they all run on top of java virtual machines like Scala, Kotlin, Clojure, etc.
I used to work with Java for mobile apps, automation tools and some services. But I still don’t have a preference on library/framework for backend services. I have some experience with Spring, Hibernate but not a big fan of it. Spark Framework and Play seem promising frameworks but Java in itself has too many configurable and boilerplate text that slow the development process. You also need to tune the JVM for an optimal performance. So from a development point of view, I want to avoid using Java as much as I can.
Java is probably the best option for any project that requires some Apache software or have some heavy open-source dependency. Modern programming languages have become easier to write, but require less understanding on how computers work. That’s why I believe Java is a good place to learn the basic concepts of programming.
To put it simply, if Docker had not been written in Go, it would not have been as successful. ~Solomon Hykes
Go or Golang is a language created by Google. It’s a native programming language which produces binary programs that run directly on top of machine hardware. It has cross platforms so the source code for windows is the same as Linux. The deployment is easy (just copy paste the binary) and the performance is highly scaleable.
Coding in Golang is really simple and during my early days it felt like writing a scripting language. However it has a unique programming paradigm and philosophy. Golang favours extension using composition rather than inheritance. It doesn’t support exceptions since it treats errors as values.
Concurrency is one big plus of Golang since it’s designed for concurrency. The lightweight thread in Golang called is called a goroutine. Every goroutine is isolated with another goroutine and can only communicate via a channel.
Also, Golang doesn’t provide pool by default, maybe because goroutine is super cheap, 1000 goroutines are comparable to 10 regular threads. Golang also has better garbage collection when compared to the others, with latency at nanosecond levels.
I like the Reflection library in Golang too, it’s much easier compared to Java. Don’t expect much for Collection library, it offers array (or slice in golang terminology) and map without luxury features but it’s enough for most cases and fits with the philosophy. No generic programming or classic Object class like Java; we need to create an empty interface to handle a concept like “Any,” which I found it’s quite tricky to implement.
Because Golang is relatively young, there’s room for discussion and a breeding of ideas on best practices and learning from others. The choice of a library of information and knowledge-sharing is however, fairly limited. For now, I prefer Golang for my projects because of its brute strength and simplicity.
What do you think? What works for you? Why? Why not? Would love to hear more. And the template: we’re hiring engineers who want to build products at scale. Did you know we have 18 products in one app? True story. visit gojek.io for roles you might be interested or just shoot a mail.