SlideShare a Scribd company logo
Learning Elixir
What is it good for?
■ Fault tolerance - maximum uptime
■ Large number of connections / IO
■ High level of concurrency
■ Distributed across machines
1.
Built on Erlang
Erlang - 1986
It was originally designed by Ericsson to support
distributed, fault-tolerant, soft real-time, highly
available, non-stop applications. It supports hot
swapping, thus code can be changed without
stopping a system.
WhatsApp
Messaging app
acquired by Facebook
for $19 billion. Used
Erlang for handling 2
million connections a
server. 10 team
members work on
Erlang and they handle
both development and
ops.
RabbitMQ
RabbitMQ is an open
source message broker
software that
implements the
Advanced Message
Queuing Protocol
(AMQP). It is fault
tolerant and
distributed.
Riak is a distributed
NoSQL key-value data
store that offers high
availability, fault
tolerance, operational
simplicity, and
scalability.
Erlang in the Wild
Erlang downsides?
■ Learning Curve
■ Syntax based on Prolog, not as
approachable (to some)
2.
Enter Elixir
About Elixir
■ Invented by José Valim, Rails committer
■ Syntax inspired by
○ Ruby
○ Clojure
■ Nicely bring together strengths of these
languages while gaining benefits of
Erlang VM
Look familiar?
Beyond Ruby...
Pattern Matching
[h | _] = [1, 2, 3]
Immutability
socket
|> read_line()
|> write_line(socket)
Pipe Operator
socket
|> read_line()
|> write_line(socket)
Protocols
defprotocol Blank do
@doc "Returns true if empty"
def blank?(data)
end
LW Processes
send self(), {:hello, "world"}
receive do
{:hello, msg} -> msg
{:world, msg} -> "won't match"
end
Metaprogramming
quote do: sum(1, 2 + 3, 4)
Immutability
Immutable data structures
Potential source of errors in Ruby:
Immutable data structures
What’s wrong with this?
■ You don’t know what to expect of your
data when you call a method
■ Especially painful for threading
○ Concurrent modification errors
○ Race conditions
Immutable data structures
In Elixir all data structures are immutable!!
■ You can safely share with other
processes
■ Don’t have to worry about data changing
under the covers
Immutable data structures
Pattern Matching
Pattern Matching
‘=’ operator in action:
“
You Keep Using That Word, I Do Not Think It
Means What You Think It Means
Pattern Matching
The ‘=’ operator handles assignment and
comparison at the same time.
Can “destructure” complex types and
assign variables automatically.
Pattern matching
Fail when error code is not as expected:
Pluck out variables from complex
structures
Pattern matching in methods
Multiple method definitions, match params:
No need for guards inside methods
Pipe Operator
Pipe Operator
■ Functional Programming: Series of data
transformations.
■ Pipe operator makes this cleaner:
|>
Pipe Operator
Metaprogramming
Metaprogramming
VS.
Macros
■ Allow extension of the language in a
clean way
■ Can control execution of passed in code
■ Gives you access to passed in AST
Processes
Lightweight processes / Message passing
■ Native support for lightweight processes
■ Can start tens of thousands of processes
■ Processes are isolated
■ Communicate via messages
Lightweight processes / Message passing
OTP
OTP / Supervision hierarchy
■ OTP= “Rails” of event driven architecture
■ Supervision hierarchies help you define
fault tolerance
■ “Let it crash” - reboot with known state
■ Define supervisors for processes and the
process / dependencies for restarting
Fault tolerance / supervision
Distribution
■ Distribution is free!
■ Can send and receive messages from
other nodes
■ Can supervise other nodes
Tooling
Growing Ecosystem
Number of tools is growing
Rails Phoenix
ActiveRecord Ecto
Rack Plug
irb iex
rake / bundler mix
Benchmarks
Phoenix
Working on Exq library - Sidekiq for Elixir
Feel free to help out!
Try it out!
Resources
■ http://elixir-lang.org/crash-course.html
■ http://learnyousomeerlang.com/
■ https://pragprog.com/book/elixir/programming-elixir
■ https://www.manning.com/books/elixir-in-action
■ http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey
■ https://github.com/mroth/phoenix-showdown

More Related Content

PDF
Elixir Into Production
PDF
ElixirConf Lightning Talk: Elixir |> Production
PDF
Atmosphere 2014
PDF
Hello elixir (and otp)
PDF
Erlang and Elixir
PDF
Introduction to Elixir
PDF
Cocoapods and Most common used library in Swift
PPTX
Elixir Phoenix
Elixir Into Production
ElixirConf Lightning Talk: Elixir |> Production
Atmosphere 2014
Hello elixir (and otp)
Erlang and Elixir
Introduction to Elixir
Cocoapods and Most common used library in Swift
Elixir Phoenix

What's hot (20)

PPTX
Introduction to Phoenix Framework (Elixir) 2016-01-07
PDF
Perl Dist::Surveyor 2011
PPTX
So we're running Apache ZooKeeper. Now What? By Camille Fournier
PPTX
Network automation (NetDevOps) with Ansible
PDF
Setup 3 Node Kafka Cluster on AWS - Hands On
PDF
Flask With Server-Sent Event
PDF
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
KEY
Curator intro
PDF
Communication in Python and the C10k problem
PPTX
Implement server push in flask framework
PDF
Puppet Camp DC 2015: Distributed OpenSCAP Compliance Validation with MCollective
PPTX
Terraform Abstractions for Safety and Power
PPTX
Controlling multiple VMs with the power of Python
PDF
Introduction to Ansible (Pycon7 2016)
PDF
PDF
ZooKeeper - wait free protocol for coordinating processes
PDF
infra-as-code
PDF
Docker and Maestro for fun, development and profit
PDF
Treasure Data Summer Internship Final Report
Introduction to Phoenix Framework (Elixir) 2016-01-07
Perl Dist::Surveyor 2011
So we're running Apache ZooKeeper. Now What? By Camille Fournier
Network automation (NetDevOps) with Ansible
Setup 3 Node Kafka Cluster on AWS - Hands On
Flask With Server-Sent Event
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Curator intro
Communication in Python and the C10k problem
Implement server push in flask framework
Puppet Camp DC 2015: Distributed OpenSCAP Compliance Validation with MCollective
Terraform Abstractions for Safety and Power
Controlling multiple VMs with the power of Python
Introduction to Ansible (Pycon7 2016)
ZooKeeper - wait free protocol for coordinating processes
infra-as-code
Docker and Maestro for fun, development and profit
Treasure Data Summer Internship Final Report
Ad

Viewers also liked (20)

DOCX
Hackers
PDF
CV.2016
ODT
Luxus immobilienmakler muenchen_bogenhausen
PDF
Asp - Brazil Thalasso Thermal SPA Natural Cosmetic and Raw Materials
ZIP
Mi congreso mx
PPT
Getting Wired At CSM
PPT
Post en eger E bar fliplock
PPTX
El tae kwon do
PPTX
Blueliv - Information Tracking with Optos [Rooted CON 2011]
PDF
Iaph abril
PDF
FIRST Mexico State Visit Report 2015
PDF
La guerra contra el pueblo
PDF
Gp carlos pellegrini
PDF
Guia de lectura el repte de l'educació
PDF
I urevista2012 num13 (1)
PPTX
Azul y Paula
PDF
Despacho 2162 a 2013 (1)
PDF
Diari del 10 de desembre de2012
PDF
Como programar en java 9na completo
PPTX
Led solution
Hackers
CV.2016
Luxus immobilienmakler muenchen_bogenhausen
Asp - Brazil Thalasso Thermal SPA Natural Cosmetic and Raw Materials
Mi congreso mx
Getting Wired At CSM
Post en eger E bar fliplock
El tae kwon do
Blueliv - Information Tracking with Optos [Rooted CON 2011]
Iaph abril
FIRST Mexico State Visit Report 2015
La guerra contra el pueblo
Gp carlos pellegrini
Guia de lectura el repte de l'educació
I urevista2012 num13 (1)
Azul y Paula
Despacho 2162 a 2013 (1)
Diari del 10 de desembre de2012
Como programar en java 9na completo
Led solution
Ad

Similar to Learning Elixir as a Rubyist (20)

PDF
Erlang/Elixir and OTP
PDF
FunctionalConf '16 Robert Virding Erlang Ecosystem
PPT
Erlang及其应用
PDF
PPTX
Rust presentation convergeconf
PPTX
Generative AI Application Development using LangChain and LangFlow
PDF
Nimbuzz march2012
PDF
Actor model in F# and Akka.NET
PPTX
Threads, signal and socket system calls.pptx
PDF
Sharing-akka-pub
PPTX
Epc 3.ppt
PPTX
PDF
Big Data Streams Architectures. Why? What? How?
PDF
Node.js security tour
PPTX
Advanced python
PPTX
Internship msc cs
PDF
Unit 1 Core Java for Compter Science 3rd
ODP
Writing and testing high frequency trading engines in java
PPTX
PCSG_Computer_Science_Unit_1_Lecture_2.pptx
PDF
Introduction To Flink
Erlang/Elixir and OTP
FunctionalConf '16 Robert Virding Erlang Ecosystem
Erlang及其应用
Rust presentation convergeconf
Generative AI Application Development using LangChain and LangFlow
Nimbuzz march2012
Actor model in F# and Akka.NET
Threads, signal and socket system calls.pptx
Sharing-akka-pub
Epc 3.ppt
Big Data Streams Architectures. Why? What? How?
Node.js security tour
Advanced python
Internship msc cs
Unit 1 Core Java for Compter Science 3rd
Writing and testing high frequency trading engines in java
PCSG_Computer_Science_Unit_1_Lecture_2.pptx
Introduction To Flink

Recently uploaded (20)

PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PPT
Introduction Database Management System for Course Database
PPTX
ai tools demonstartion for schools and inter college
PDF
System and Network Administration Chapter 2
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Digital Strategies for Manufacturing Companies
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Introduction to Artificial Intelligence
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
ManageIQ - Sprint 268 Review - Slide Deck
Introduction Database Management System for Course Database
ai tools demonstartion for schools and inter college
System and Network Administration Chapter 2
Navsoft: AI-Powered Business Solutions & Custom Software Development
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Upgrade and Innovation Strategies for SAP ERP Customers
How to Choose the Right IT Partner for Your Business in Malaysia
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Digital Strategies for Manufacturing Companies
Odoo Companies in India – Driving Business Transformation.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
2025 Textile ERP Trends: SAP, Odoo & Oracle
Softaken Excel to vCard Converter Software.pdf
Introduction to Artificial Intelligence
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
How to Migrate SBCGlobal Email to Yahoo Easily

Learning Elixir as a Rubyist