The HOW and WHY behind transitioning from RUBY to ELIXIR
Before we get down to business, you might be wondering what Elixir even is. Thankfully, the TechLifeSydney blog is here to explain it all.
Elixir is a dynamic, functional language designed for building scalable and maintainable applications. Elixir leverages the Erlang VM, known for running low-latency, distributed and fault-tolerant systems, while also being successfully used in web development and the embedded software domain.
Pinterest uses Elixir for its notification system, Bet365 switched from Java to Erlang and Elixir so it could scale more easily, Whatsapp wrote its application in Erlang, which is compiled to same bytecode that Elixir is, and lastly, BleacherReport switched from Ruby to Elixir to reduce complexity and increase performance and speed of development.
In Australia, Expert360 is one of the companies leading the way in Elixir development. Due to the limited number of engineers with commercial experience, it’s invested heavily in recruiting and supporting engineers transitioning from other languages, especially Ruby.
Here’s what we learned from three Expert360 engineers; Orion, Samvit and Samantha…
Had you heard about Elixir prior to meeting with the team at Expert360?
Orion: “Yes, I’ve been working in Elixir for quite some time prior to joining Expert360, mostly for US-based firms, as I was residing there at the time. All the companies were former Rails shops and because of the community knew of Elixir. Jose Valim (the creator of Elixir) was a core contributor to Rails. These shops were either converting projects to Elixir or had greenfield projects that were started in Elixir.”
Samvit (pictured): “Nope, I hadn’t heard of Elixir before joining Expert360.”
Samantha: “I’d heard of it but didn’t really know anything about it.”
What are the main differences that you’ve seen between Elixir and Ruby?
Orion: “When I was a Ruby developer there was a lot of ‘mental overload’ when coding because, when working with objects, you have to consider all the points the object your working on can be mutated. With Elixir, I only had to care about the data I was working on at that given moment in that given function. I began to think more about how data flows through the component I was building.”
Samvit: “The first couple of things I noticed were pattern matching and the pipe operator, which I thought were pretty cool. Another thing I experienced was that there is less magic in Elixir’s world (Phoenix) than in Ruby (Rails) when building web applications, which is great. I also found Elixir to be more readable, predictable and easier to reason with. There were other differences I found as well like; no loops, no state being maintained but function outputs depending entirely on inputs (although you can still use genservers if you want state), immutability and basically the functional paradigm in general.”
Samantha: “Firstly functional vs OOP is the obvious difference between Elixir and Ruby. Thinking about data in a functional way definitely takes a shift in thinking. Also as Samvit mentioned, when you first come to Elixir pattern matching and the pipe operator are the most obvious syntactical differences, but once you’ve got the hang of using them it’s hard to look back. Coming from a Rails background, there are also notable differences between ActiveRecord, Ecto, Rspec and Exunit. For me, ActiveRecord and Rspec are more user friendly, but Ecto and Exunit aren’t too far behind.”
How long did it take to get to grips with Elixir? What were the main challenges you faced? And what support did you have to help speed up the transition?
Orion: “It took me a few months to undo the OOP mindset so to speak so that was a challenge. There wasn’t much transition due to the similarity in syntax. At the time, the community was small and still is compared with Ruby’s community, so being able to take advantage of pre-built code (contributions) means packages are limited, but this would also be an opportunity to implement functionality on your own. The support is always there and it keeps getting better as the community grows. The mailing lists, Slack channels, and blogs are there. I’ve also attended several conferences in the past and find a lot of leaders in the community always approachable and accessible.”
Samvit: “It was pretty easy to write Elixir code and get it to a workable state, but it took a bit more time and reading, to not only learn the idiomatic/Elixir way of doing things, but think in that way. The main challenge wasn’t Elixir itself, but getting to grips with Elixir in conjunction with other parts of the tech stack like Phoenix, Ecto and Absinthe simultaneously. Thankfully, Expert360 provided a lot of support in the form of workshops, share-back sessions and guidance from other Elixir developers.”
Samantha: “I was really surprised with the ease of the transition from Ruby to Elixir. Ruby was the first backend language I learned and so changing to Elixir was quite daunting. However, the syntactic similarities make it a great language to learn after Ruby. Getting to grips with pattern matching and the importance of arity is a big step in the journey. One of our seniors once told me if you are ever thinking about using a conditional statement, it probably means you can use pattern matching instead. From a functional point of view, thinking of data as being immutable is something that has happened gradually for me and something that has sunk in after writing code and seeing it in practice.
“Expert360 has been really great with the transition, as most of our devs didn’t know Elixir prior to working here there’s a culture of learning and sharing knowledge. Everyone understands that online resources for Elixir are more limited than other languages, so we have to lean on and learn from each other. We also have a couple of developers who have been in the Elixir community for years and they have been great at showing us best practices and improving our codebase for the future.”
What would you say to any engineers who don’t know about Elixir? Do you have any resources they should check out?
Orion: “I would say its a language that’s a pleasure to work in, with powerful features backed by the OTP – Erlang. You might not need all that firepower, but it’s good to know it’s there – for free when needed. The tooling is excellent and guides you towards language/community best practices as well programming best practices like test driven development (TDD), which is much easier in Elixir unlike Ruby.”
Samvit: “I would say it’s great to get into if you have some prior programming experience, as it’s easy to learn and a pleasure to work with. It’s got a competitive advantage over other languages because of concurrency, performance, scalability, fault-tolerance and by being a language that’s very developer friendly. I found Elixir School to be helpful, exercisms helped to develop programming skills, and the talks at the Elixir Meetup, which Expert360 hosts, were engaging.”
Samantha: “If you come from a Ruby background, and you’re interested in learning a functional language, then Elixir is a really great option. The syntactic similarities mean you’re given a little boost when starting out. Aside from that however, it’s great to know that you are working with a language that is built to scale when necessary. There are plenty of resources online to get you started – from online video tutorials, to talks from the yearly Elixir conferences, exercism exercises etc.”
What is the Elixir community like in Sydney?
Orion: “Expert360 as a company is a great group to work for. I’m working remote from Fiji so I’m yet to meet other members of the Sydney Elixir community, but hope to soon.”
Samvit: “It’s a niche group but growing rapidly. The talks at the Elixir Meetup are always informative, and the community itself is very welcoming of new Elixir developers.”
Samantha: “The Elixir community is small, but a group who are really passionate about Elixir and want to spread their knowledge. Expert360 hosts the Elixir Meetup each month, which has a solid group of regulars and welcomes newcomers too. I hear of more companies each day moving to Elixir, which is exciting for the future.”
You can read more about engineering at Expert360 in our Insights blog: