How did you learn Elixir?

Interested in hearing what has worked well for those who feel they are now relatively proficient in Elixir - perhaps it can help our newbies :slight_smile:

For those just starting out, also check out the thread: How are you learning Elixir?

1 Like

Relatively proficient, ok. I worked myself through some tutorials: mainly “programming elixir”, “elixir in action” and at last “programming phoenix”. After that I started on a learning project for which I thought elixir with it’s actor model and phoenix with it’s channels (soft real-time communication) would be ideal. That was a BPMS. I’m very happy with the results so far. http://elixir-lang.org proved to be of great value, in particular http://elixir-lang.org/getting-started/mix-otp/supervisor-and-application.html (and next pages, see the buttons a the bottom of the page), with KV.Registry, ETS, supervisors and monitors. Of course this forum has been of great help also, when I was stuck I always got good advise.

3 Likes

I hesitate to call myself proficient until i’ve been doing it for at least a few years and have shipped enough high volume systems to know I’ve seen a fair number of edge cases where what I thought I knew breaks down. However, I’ve got a few systems in production now and I feel relatively comfortable in Elixir.

How I got here was simply by writing code. I always find the best ways to learn something (for my learning style) is by doing it, which means I started with a small project to enable a tiny little feature in a production system I own. Ordinarily I would have never brought in a whole new platform for such a thing, even as a microservice, but since the goal was to edge it in slowly, it was a low-risk way to do so. I deployed it to heroku, and that was enough to let me gauge what performance was going to be like when I started migrating over heavier features. (As anyone who’s done this from Rails to Phoenix will attest, the performance differences were… profound.)

I’ve done a toy app or two in order to learn something specific, but I find the best way to force myself to pick it up is to put the onus of shipping to production on me.

What I will also add is that after that initial success, I bit off more than I could chew and floundered for awhile as I tried to do everything “the elixir way” before I really grokked all of it. What I would suggest to someone going down this road today (coming from a platform you’ve got lots of experience in, like Rails or whatever, to Elixir and Phoenix) is not to worry about doing it the Elixir way at first. Just rewrite things the same way you would have in Rails for a little while. Yes, that’s terrible advice over the long term. But you’re biting off a lot of new ideas, and writing stateful services is a very different proposition than you’re probably used to. Get comfortable with syntax and idioms and just soak in the other ideas over time. When you’re ready, you can find a migration path to make your stateless service into something more stateful that leverages OTP in all its glory.

Also, in terms of reading material, Dave Thomas’ book Programming Elixir is a great starting point, but jump to Saša Jurić’s Elixir In Action sooner than later. It goes much deeper into OTP and really helped my mental model a great deal. Beyond that, Designing for Scalability with Erlang/OTP is a great read once you’re more comfortable with the platform. Erlang got a lot easier to read once I was over the syntax hump of Elixir.

5 Likes

I feel comfortable (if not really “proficient”, that’s a scary word) writing Elixir. Before learning it I had experience in other languages and Rails-like MVC frameworks. I also used some “FP patterns” to contain complexity while rewriting a legacy application just before starting with Elixir. Oh and I barely touched Ruby / Rails.

As for learning Elixir:

  • Getting started guide and OTP guide from elixir-lang.org
  • All the Phoenix guides
  • A tiny project to have a feeling of Elixir, we gave a discount and fixed price for it
  • Programming Phoenix book
  • A bigger project and Programming Elixir book at the same time
  • Started to (try to) answer questions here since the best way to understand something is to explain it to someone else :slight_smile:
  • More Elixir projects since our clients were finally “sold”
  • What’s new in Ecto 2.0 and then Elixir in Action books - these are not strictly needed to get started but Elixir in Action is very good at delivering the idea of how cool OTP is
  • Designing for Scalability with Erlang/OTP will probably be my next book

The language is pretty minimal and well documented so it is easy to pick it up and be productive in it, this should help the adoption a lot.

3 Likes

I first went through some of the guides on the elixir-lang website, then I went through Programming Elixir and some bits of Elixir in Action. Then I went through Programming Phoenix and quite a few phoenix tutorials, especially channels. Eventually I wrote a small tic-tac-toe game with a lobby system using React and Phoenix. It was really instructive and I learned several things, namely how to use Ecto Multi to chain a function (in this case that emits to a channel) after a successful db transaction, how to use a supervisor to spawn genservers (which hold the state of an individual tic-tac-toe game) and register them in the :global name list.

Now I’m looking to do more strictly Elixir backend stuff, hopefully distributed systems or learning GenStage + Flow.

3 Likes

I build a simple chat app in Elixir to learn about GenServer, then I built a Slack Bot, then I built an Algolia Indexer, then I…

Basically the answer is to build stuff… It’s almost always how I learn anything… Elixir School was a huge help, and I read 2 Elixir/OTP books that I can’t remember the name of.

Lastly I was lucky enough to have direct access to Sean Callan of Elixir School who did code reviews of all my stuff and helped me progress to proficiency. Having a mentor is always a huge help.

2 Likes

in regards to this, one thing you can do so you don’t learn bad habits is get it working however you can, then refactor it a few times the Elixir way… Learning to do something wrong, isn’t really going to teach you anything.

If your function is more than a few lines of code you probably need to refactor it into more functions. Pattern matching is your friend. Recursive pattern matching is just mind blowing.

1 Like

It is not a question.

This is all about How I level up in Elixir.

Happy Coding !!
Love to hear your story.

In AU we have events called Rails Camps which run for 4 days (Friday-Monday). The running joke is that even though it’s called “Rails” Camp, it’s typical for people to choose something other than Rails to use / play with. I chose Elixir.

So I sat down for that weekend and tried building an IRC server in Elixir. I didn’t get very far! I was able to get a client to connect to a channel and send a message to it. Looking back I can tell it’s not the greatest code. Here it is for your viewing pleasure: https://github.com/radar/elixir-irc

The Elixir docs from the website are great, as is Elixir School’s stuff. I later read through Programming Elixir and Programming Phoenix. But building stuff and reading through other people’s “real” code has definitely helped the most.

For learning Elixir/Phoenix, I built a little implementation of a coupon code system (https://github.com/radar/promo) and rewrote a very small Rails app into Phoenix: (https://github.com/radar/logs.ex). These both are application ideas that I understand how to do very easily in Ruby, and so it was just a matter of thinking/discovering how I would do it in Elixir too.

Sharing code with people on the Elixir-Lang IRC channel and Elixir Slack has also been a great way to get feedback and learn new things.

2 Likes