Just before the new 3.1 release of Ruby around Christmas, we would like to celebrate the anniversary of its first public release back in 1995. To do so, we invited one of our Ruby masters - Aleksandar Ivanov from the Funding Circle team, to share what he likes about the language and how he sees its advantages compared to other programming languages
The best feature of the language is its expressiveness. It allows us very clearly to express an intent, a problem and ourselves. The language’s syntax is quite readable, and you can write code almost as you write English. A testament to this is what I call the "Product Owner Test". In Funding Circle, when working on a business feature/issue (usually not frontend-related), we often demo the code to people who may not be that technical or have little programming experience (for example with Excel). This gives us the opportunity to pair with colleagues who are not programmers and often spot bugs in our code. I like to call it the “Product Owner Test” as the first time we did this was by chance. We didn’t prepare for the demo but decided to showcase the code anyway. Then one of the product owners noticed a bug in it.
Let's explore the implications of relying on a language that allows you to express yourself clearly.
When you write in Ruby, you focus on the problem you are trying to solve and how to solve it cleanly. There is a constant feeling that if the code is not easy to write and test, then there is some fundamental problem e.g. a bad abstraction or a missing one. For example, compare the Ruby and Java code for working with Kafka:
The most striking difference is that in the Ruby example, I believe tacitly, the code was written much more clearly and is abstracted, so different concerns like loading the config and configuring the producer are separated from the main logic. While in the Java example, concerns are mixed, and the code is a bit unclear. Of course, you can write clean Java code as well, and yes, both examples are good and showcase how to use Kafka. But with Ruby, the language expressiveness forces you to think about clarity by default and even in the example code, the Ruby way shines.
In other languages, people focus a lot on technicalities and language quirks. For instance, if comparing conferences like Cppcon and Rubyconf, they feel completely different. The Rubyconf consists of tracks like Team / Ethics / Complex Sociotechnical Systems, while during the Cppcon, things tend to be more technical. My feeling is that C++ devs, for example, focus too much on the edge cases of the language, even in their day-to-day work. In the Ruby world, we rarely focus on quirks of the language, and it is usually just for fun. (For the record, personally, for me, the Cppcon is much more interesting :)).
When I started using Ruby (around 2012), it was one of the most influential programming languages. The majority of languages were trying to emulate or copy libraries from Ruby. I remember writing web apps in Perl using Dancer and wondering what is this Sinatra Ruby project the docs talk about. (And just in case you are not familiar with what sinatra is, here’s the GitHub repo description “Classy web-development dressed in a DSL”).
As the language and community transitioned from the cool kid to the getting the job done mentality, the gems (libraries) got even better. If you learn Ruby today, you basically learn what to expect from any framework/library out there. Prime and influential examples are gems like rails – web development, sidekiq - background jobs/worker queues, hutch - rabbitmq messaging consumers.
Usually, Ruby developers can start working on existing projects without prior knowledge. In my experience, whenever there is a production issue with a Ruby project, developers, who don't know what is going on, are able to connect to the app and debug it in just 10-15 minutes. Ruby developers tend to directly dig into unfamiliar code without hesitation. This is directly related to the expectation that you’ll easily understand the tech and business logic behind the code from the code itself (still, docs are nice to have). In other languages, I usually see more hesitancy, and people prefer someone to introduce them to a project. This just creates additional and unnecessary work for everyone.
Ruby is very popular in initiatives like Rails Girls. The language is perfectly suited to promote programming as it is easy to understand by anyone with just a bit of guidance. It is great when teaching in schools and universities, particularly for courses that aim to excite students or explain what exactly software programmers do in their day-to-day work. For example, in TUES, Ruby is used in their “Technology of programming” course. And in Sofia University, there was an extremely popular ruby course where the students were required to not only learn the syntax of the language but also to build and present proper projects within the Ruby ecosystem.
However, Ruby isn't the best choice to introduce basic programming to children. I would suggest kids start with simple statically typed language such as C so that they fight the compiler a bit. Then when they stop using Word to write code and start understanding how they err (this takes 1-2 years), it is time to bring a language like Ruby.
In Ruby, you can write highly readable code. There is a high focus on style and clarity in the community. It is worth learning the language and its ecosystem just to learn this perspective right.
P.S.: With Ruby 3.0 & 3.1, the language is getting a bit more interesting from the technical point of view as well.
More about the author:
Aleksandar Ivanov (Sasho) was one of the first joiners in the Funding Circle team back in 2016 and is currently a Senior Ruby Engineer. Sasho has more than 10 years of experience in software development. He teaches at Sofia University and TUES and has been an instructor at Rails Girls Sofia Workshops several times. Outside of work and programming, he likes to play chess for fun and glory and, as he admits, watches too much Star Trek.
Should you be a passionate Ruby geek who happens to also enjoy logic games and science fiction TV shows and movies, you’d be more than welcome to join Sasho’s team. Even if you’re not into these particular activities, the Funding Circle’s team consists also of passionate runners, nature lovers and adventurous travellers who are always ready to accept curious folks and face new challenges together.
Find out more about the vacancies here, and be sure to apply.