Any tips for someone just starting out learning Elixir?

github logo ・1 min read

I recently decided to start learning Elixir. I've already got a project in mind (I'm going to be converting some existing tools I use regularly on my systems from Python (a language I already have solid experience with) to Elixir since the concurrency model should help them be significantly more efficient), and I've worked through the whole 'Getting Started' guide on the website without any significant issues.

However, it's drastically different from most of what I'm used to (I'm coming from a mostly Python background, with some JS and SH experience), and I'm wondering if anybody might have some advice for people new to the language? Any particular gotcha's to watch out for that aren't well documented? Possibly things that need to be handled significantly differently in Elixir compared to other languages for efficiency reasons?

twitter logo DISCUSS (3)
markdown guide

Heya welcome to Elixir πŸ‘‹! I can't really pull any tips out of my head as of right now, but I've compiled a list of resources for you to checkout, so here goes!

P.S: With courtesy from ElixirForum (probably the biggest Elixir community forum?), you can sometimes get up to 40% off the learning resources! Just try to input elixirforum whenever you try to checkout :)

In fact I've updated this to be in the sidebar's wiki of the #elixir tag,


In learning Elixir, it's important to think functionally. You're coming from languages that are traditionally referred to as object-oriented languages, but they still allow you to program functionally.

Functional programming might seem intimidating at first, but it's easiest to think about the difference with this simple JavaScript example:

function sayHello(name) { console.log(`Hello, my name is ${name}`) }

function Person(name) { = name;

Person.prototype.introduce = function() { sayHello( }
Person.prototype.getName = function() { return }

function introduceUsingFP(person) { sayHello(person.getName()) }

var harryPotter = new Person("Harry Potter");

// Hello, my name is Harry Potter

# FP
// Hello, my name is Harry Potter

Notice that in OOP, you have an object which has data and behavior (the introduce() function). In FP, you have an object with data, but its behavior is not a part of the object.

So in Elixir you'd have a module Person, which defines a struct using defstruct. It's best-practice to then implement functions in this module which accept an instance of the struct, and do something to/with it.

defmodule Person do
  defstruct [:name]

  def introduce(%Person{} = person) do
    IO.puts("Hello, my name is " <>

harry_potter = %Person{name: "Harry Potter"}
# Hello, my name is Harry Potter

You will witness this in many libraries in Elixir. Ecto's changeset functions are a great example. All of the validation functions in the Ecto.Changeset module accept an Ecto.Changeset struct and return an updated Ecto.Changeset struct.

My Elixir knowledge really took off after I read the book Programming Elixir β‰₯ 1.6: Functional |> Concurrent |> Pragmatic |> Fun. It starts with basic Elixir, but by the end of the book familiarizes you with complex topics such as Open Telecom Platform (OTP) and metaprogramming using macros. I now use it as reference when I need some clarification on concepts ranging in complexity.

Classic DEV Post from Jan 25

Letter to Myself Ten Years Ago

Inspired by the viral 10-year challenge on social media, when people show the world what they looked like 10 years ago, I decided not to share my photos of that time.

Austin S. Hemmelgarn profile image
I run IT and do some light development work for a small manufacturing firm. When I'm not busy with work, I spend much of my time either gaming, or trying to help people by spreading my knowledge.

Better understand your code.