DEV Community

Cover image for Are Ruby and Elixir the Perfect Yin and Yang?
Josh Hadik
Josh Hadik

Posted on • Edited on

Are Ruby and Elixir the Perfect Yin and Yang?

I’ve been starting to prep for the job hunt the last couple weeks, and you know what that means… algorithms!

I’ve been spending around 45 minutes a day working through some of the popular interview questions, and one of the things I've strived to do from the start is look for multiple unique solutions to each problem.

At first, I was just using Ruby because it’s my strongest language. But yesterday I decided to try something different.

Instead of looking for multiple solutions in just Ruby, I would solve each problem twice. Once in Ruby, and once in Elixir.

I’ve been doing this for just two days now and I can already tell it was one of the best decisions I ever made!

For those of you who don’t know, Ruby and Elixir are two languages that are aesthetically very similar, but behave completely differently behind the scenes.

Ruby is an object-oriented language at heart and relies heavily on iteration and mutation to solve problems

Elixir is a functional language that relies on recursion and pattern matching.

Using both to solve problems everyday has forced me to look at the same problem from two completely different perspectives, and use two totally different sets of tools to solve it.

In the long run, I think doing this will make me a more multidimensional developer, which I think is one of the key skills that separates the beginners from the pros.

Anyways, this got me thinking a lot about the whole Ruby / Elixir ecosystem and the crossover between the two, and I realized that the two are almost the perfect yin and yang.

Polar opposites in how they operate but with a lot of similarities and a strong relationship. Where one is weak the other is strong, and if you can master both you become a much stronger developer.

What do you guys think… Are Ruby and Elixir the perfect yin and yang?

Are there any other two languages out there that fit the mould?

Top comments (2)

Collapse
 
josegonz321 profile image
Jose Gonzalez

Hey Josh,

Not sure what do you mean by perfect yin and yang.

As you already mentioned, they are both different paradigms: OOP and FP, respectively.

Some would argue that learning FP helps your OOP skills and ups your general programming knowledge.

Although I have never gotten paid to write Ruby, I'm familiar with the language and can follow along. (I've been doing C# for 15yrs or so cumulative years).

As per Elixir, I have not been deep dive into it. If you are interested in learning it, here's a great starting point: Getting Started with Elixir.

Have a great journey!

Collapse
 
joshhadik profile image
Josh Hadik

Thanks for this!

I call them "the perfect Yin and Yang," because they are such different paradigms but with such a similar style.

I think if you can master a FP and an OOP language, you become a stronger developer. Not only does learning both give you a greater mastery over the other, but now you have two completely different languages you can choose between, both optimized for different situations. Which I think ties in nicely to the concept of Yin and Yang which (according to Wikipedia) "describes how seemingly opposite or contrary forces may actually be complementary, interconnected, and interdependent [...] and how they may give rise to each other as they interrelate to one another"