SlideShare a Scribd company logo
1 of 51
Download to read offline
What is the deal with Elixir?
Jorge Madrid
@mr_coffeey GitHub.com/MrCoffey
Are you happy with the language
you are currently working on?



!
“What Elixir brings to the table is a
complete different surface syntax, inspired
by Ruby. What you might call a “non-scary”
syntax, and a load of extra goodies.”
- Joe Armstrong
Production level-tested 30 years old technology
Features Inherited From Erlang
Framework for parallel and distributed programming OTP
Quickly scale
Pattern matching
Functional programming language
Friendly and familiar syntax
New Features brought by Elixir
Build-in unit testing suite
Support for meta-programming via macros
Doctests
Pipes
Phoenix
Mix
Support for umbrella applications
Can Elixir scale?
Erlang VM (BEAM)
Can distribute processes across all available CPU cores
Each process only about 1kb
Each process has its own Garbage Collector
It can handle calls from local or remotes nodes
Case Study - Bleacher Report
150 AWS Instances
Large engineering teams per app
Multiple complex caching strategies
8 year old Rails app
Case Study - Bleacher Report
1/5th the AWS instances (30)
10ms - 30ms average response times
Largest average spike: 400ms
About one engineer per app

No caching
Elixir / Phoenix rewrite
Case Study - Bleacher Report
Basic Types
Basic Types
Integers
Support for binary, octal, and
hexadecimal numbers comes built in:
Basic Types
Floats
In Elixir, float numbers require a decimal
after at least one digit; they have 64 bit
double precision and support e for exponent
numbers:
Basic Types
Booleans
Elixir supports true and false as booleans;
everything is truthy except for false and nil:
Basic Types
Atoms
An atom is a constant whose name is their
value. If you’re familiar with Ruby these are
synonymous with Symbols:
Booleans true and false
a r e a l s o t h e
atoms  :true  and  :false 
respectively, as well
as module names.
Basic Types
String
Strings in Elixir are UTF-8 encoded and are
wrapped in double quotes, in Elixir single
quotes returns a charlist:
Basic Types
tuples
Elixir uses curly brackets to define tuples.
Like lists, tuples can hold any value:
Basic Types
Lists
Elixir uses square brackets to specify a list
of values. Values can be of any type:
Basic Types
chartlists
A charlist is nothing more than a list of code
points. Char lists may be created with single-
quoted literals:
Basic Types
maps
Whenever you need a key-value store, maps are
the “go to” data structure in Elixir. A map is
created using the %{} syntax:
Basic Types
nil
Yes, Elixir also have a dark side 😕 ,
nevertheless, Elixir provides options to handle
and avoid it.
👆via pattern matching
✌returning tuples
Pattern Matching
Pattern Matching
In Elixir, the = operator is actually
called the match operator.
equal sign != assignment
Pattern Matching
a = 1
1 = 2
Is the following a valid expression?
Pattern Matching
[1] = [1]
Pattern Matching
[a] = [1]
a = 1
Pattern Matching
A list also supports matching on its own head
and tail:
Pattern Matching
A pattern match will error if the sides can’t
be matched, for example if the tuples have
different sizes:
Pattern Matching
def foo(1) do
…
def foo(2) do
…
def foo(2)
Control Flow Structures
Control Flow Structures
case
case allows us to compare a value against many
patterns until we find a matching one:
Control Flow Structures
if and unless
Elixir also provides the macros if/2  and
unless/2 which are useful when you need to
check for only one condition:
structs
structs
structs can be seen as an constructor method
in languages as ruby.
macros
Macro rule #1
DONT’T WRITE THEM
Mix
Mix is Bundler, RubyGems, and Rake combined into
a executable, You need to have both mix  and
elixir executables in your PATH. That’s what
happens when you install Elixir.
tests
environments
Modules and Functions
In order to create
our own modules in
Elixir, we use
the defmodule macro.
Here Math defines
the name of the
module.
modules
Modules and Functions
named functions
Inside a module, we can define
functions with def/2 and
private functions with defp/2
Modules and Functions
compilation
Let’s assume we have a file named math.ex with
the following contents:
T h i s f i l e c a n b e
compiled using elixirc
If we start iex our
module definition will
be available
alias, require, and import
In order to facilitate software reuse, Elixir provides three
directives (alias, require and import) plus a macro called use:
Modules and Functions
alias
alias, require, and import
In order to facilitate software reuse, Elixir provides three
directives (alias, require and import) plus a macro called use:
Pipe
foo(bar(baz("hello world"))
Pipe
result = baz(“hello world”)
result = bar(result)
result = foo(result)
Pipe
result =
“hello world”
|> baz()
|> bar()
|> foo()
… and there is much more so
learn you some Elixir!

More Related Content

What's hot

Full Python in 20 slides
Full Python in 20 slidesFull Python in 20 slides
Full Python in 20 slides
rfojdar
 
6 data types
6 data types6 data types
6 data types
jigeno
 

What's hot (19)

Unit 1 question and answer
Unit 1 question and answerUnit 1 question and answer
Unit 1 question and answer
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Swift Programming Language
Swift Programming LanguageSwift Programming Language
Swift Programming Language
 
Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiers
 
Of Lambdas and LINQ
Of Lambdas and LINQOf Lambdas and LINQ
Of Lambdas and LINQ
 
Esta charla es una monada - Introducción a FP en JavaScript con Ramda
Esta charla es una monada - Introducción a FP en JavaScript con RamdaEsta charla es una monada - Introducción a FP en JavaScript con Ramda
Esta charla es una monada - Introducción a FP en JavaScript con Ramda
 
Swift Tutorial Part 1. The Complete Guide For Swift Programming Language
Swift Tutorial Part 1. The Complete Guide For Swift Programming LanguageSwift Tutorial Part 1. The Complete Guide For Swift Programming Language
Swift Tutorial Part 1. The Complete Guide For Swift Programming Language
 
Python-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutabilityPython-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutability
 
The Little Wonders of C# 6
The Little Wonders of C# 6The Little Wonders of C# 6
The Little Wonders of C# 6
 
Swift Tutorial Part 2. The complete guide for Swift programming language
Swift Tutorial Part 2. The complete guide for Swift programming languageSwift Tutorial Part 2. The complete guide for Swift programming language
Swift Tutorial Part 2. The complete guide for Swift programming language
 
JavaScript: Core Part
JavaScript: Core PartJavaScript: Core Part
JavaScript: Core Part
 
10. symbols | ES6 | JavaScript | TypeScript
10. symbols | ES6 | JavaScript | TypeScript10. symbols | ES6 | JavaScript | TypeScript
10. symbols | ES6 | JavaScript | TypeScript
 
Full Python in 20 slides
Full Python in 20 slidesFull Python in 20 slides
Full Python in 20 slides
 
C++vs java
C++vs javaC++vs java
C++vs java
 
6 data types
6 data types6 data types
6 data types
 
Intro to Java for C++ Developers
Intro to Java for C++ DevelopersIntro to Java for C++ Developers
Intro to Java for C++ Developers
 
Chapter 9 python fundamentals
Chapter 9 python fundamentalsChapter 9 python fundamentals
Chapter 9 python fundamentals
 
C++ to java
C++ to javaC++ to java
C++ to java
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#
 

Similar to What is the deal with Elixir?

Similar to What is the deal with Elixir? (20)

Elixir
ElixirElixir
Elixir
 
Introduction to Elixir
Introduction to ElixirIntroduction to Elixir
Introduction to Elixir
 
(6) c sharp introduction_advanced_features_part_i
(6) c sharp introduction_advanced_features_part_i(6) c sharp introduction_advanced_features_part_i
(6) c sharp introduction_advanced_features_part_i
 
Erlang, an overview
Erlang, an overviewErlang, an overview
Erlang, an overview
 
Mule expression language
Mule expression languageMule expression language
Mule expression language
 
Perl Reference.ppt
Perl Reference.pptPerl Reference.ppt
Perl Reference.ppt
 
Maxbox starter19
Maxbox starter19Maxbox starter19
Maxbox starter19
 
OCL in EMF
OCL in EMFOCL in EMF
OCL in EMF
 
Shapeless- Generic programming for Scala
Shapeless- Generic programming for ScalaShapeless- Generic programming for Scala
Shapeless- Generic programming for Scala
 
Scala - The Simple Parts, SFScala presentation
Scala - The Simple Parts, SFScala presentationScala - The Simple Parts, SFScala presentation
Scala - The Simple Parts, SFScala presentation
 
UML01
UML01UML01
UML01
 
presentation_intro_to_python
presentation_intro_to_pythonpresentation_intro_to_python
presentation_intro_to_python
 
presentation_intro_to_python_1462930390_181219.ppt
presentation_intro_to_python_1462930390_181219.pptpresentation_intro_to_python_1462930390_181219.ppt
presentation_intro_to_python_1462930390_181219.ppt
 
C# note
C# noteC# note
C# note
 
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
 
(6) c sharp introduction_advanced_features_part_i
(6) c sharp introduction_advanced_features_part_i(6) c sharp introduction_advanced_features_part_i
(6) c sharp introduction_advanced_features_part_i
 
20240412 QFM010 Elixir Reading List March 2024
20240412 QFM010 Elixir Reading List March 202420240412 QFM010 Elixir Reading List March 2024
20240412 QFM010 Elixir Reading List March 2024
 
MDE=Model Driven Everything (Spanish Eclipse Day 2009)
MDE=Model Driven Everything (Spanish Eclipse Day 2009)MDE=Model Driven Everything (Spanish Eclipse Day 2009)
MDE=Model Driven Everything (Spanish Eclipse Day 2009)
 
220 runtime environments
220 runtime environments220 runtime environments
220 runtime environments
 
How to create a programming language
How to create a programming languageHow to create a programming language
How to create a programming language
 

Recently uploaded

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 

Recently uploaded (20)

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 

What is the deal with Elixir?