SlideShare a Scribd company logo
1 of 35
Download to read offline
My Elixir HelWo lolrd
Why Elixir is the next big thing in tech world
Claudio D’Alicandro
AdEspresso
By Hootsuite
Twitter: @_cdali
Github: claudio-dalicandro
19.000.000.000$
If you're thinking about WhatsApp, you're right... But what
is behind a 19,000,000,000 dollars idea?
A bit 'of numbers referring to WhatsApp
35
The engineers who worked for WhatsApp before
acquisition
450.000.000
WhatsApp users before
acquisition
Erlang and the BEAM
● Light-weight process
● No memory sharing
● Code hot-swap out of the box
● Actor modeling
● Battle tested virtual machine
My trouble with Erlang
● Prolog-inspired syntax
● Single assignment
sometimes is just as
problematic as
destructive assignment
● Strings-as-lists sucks
What if I told you that you can have all the advantages, and no flaws?
Elixir
The Toolbox
mix
Mix is a build tool that
provides tasks for
creating, compiling, and
testing Elixir projects,
managing its dependencies,
and more.
Mix
Create an Elixir project is simple:
$ mix new helwo_lorld 
--module HW
exUnit
Unit testing framework for
Elixir.
ExUnit
● Simple macros help defining
readable tests
● ExUnit.DocTest implements
functionality similar to
Python’s doctest.
● ExUnit.Callbacks defines both
setup_all and setup callbacks,
as well as the on_exit/2
facility
● You can define the test as
asynchronous by adding “async:
true” in the use statement
Credo
A static code analysis
tool for the Elixir
language with a focus on
teaching and code
consistency.
Credo
● shows you refactoring
opportunities in your code
● shows complex or duplicated
code fragments
● warns you about common
mistakes
● shows inconsistencies in your
naming scheme
● helps you enforce a desired
coding style
The Language
Data types
Elixir Basic types
● Integer
● Float
● Boolean
● Atom
● String
● List
● Tuple
Keyword lists
A keyword list is a list of tuples
Maps
A map can be “updated”
A map can be destructured through pattern matching
Pattern Matching
What is the pattern matching?
Actually, your “=” operator sucks.
Destructuring
You can use the pattern matching to
destructure the input of a function
Pattern matching usages
Guards
Clauses also allow extra
conditions to be specified
via guards
Polymorphism
Finally, it is important to specify that by using pattern
matching you can implement polymorphism, indeed, you can set
the same function multiple times, so as to cover different
patterns with different behaviors
Parallel processing
Spawn a process
In Elixir, all code runs
inside processes. Processes
are isolated from each
other, run concurrent to one
another and communicate via
message passing. Processes
are not only the basis for
concurrency in Elixir, but
they also provide the means
for building distributed and
fault-tolerant programs.
Link and Monitoring
The majority of times we
spawn processes in Elixir,
we spawn them as linked
processes.
When two process are linked
the failure in one process
propagates to the other.
Finally, we can set up a
monitor so that the parent
process will receive a
notification every time a
child exits
Why processes are so important?
Obviously the processes are
primarily a tool to perform
parallel computations, but thanks
to the BEAM and the infinite number
of processes that can run on the
inside, they have become something
more…
Actor Modeling
OTP
No, this not means one time
password
The Open Telecom Platform
is a collection of
Middleware, libraries and
tools
Tasks, Agents, GenServers, GenEvents...
Tasks
meant to execute
one particular
action throughout
their lifetime,
often with little
or no
communication with
other processes.
store state that
must be accessed
from different
processes
Agents
standard set of
interface
functions,include
functionalities
for tracing and
error reporting
GenServers
event manager
process with an
arbitrary number
of event handlers
which are added
and deleted
dynamically
GenEvents
Actor Modeling
Questions?

More Related Content

Similar to My elixir helWo lorld

The Taming Of The Code
The Taming Of The CodeThe Taming Of The Code
The Taming Of The CodeAlan Stevens
 
Tortuga-A simulation software
Tortuga-A simulation softwareTortuga-A simulation software
Tortuga-A simulation softwareSyeda Nyma
 
How to use Artificial Intelligence with Python? Edureka
How to use Artificial Intelligence with Python? EdurekaHow to use Artificial Intelligence with Python? Edureka
How to use Artificial Intelligence with Python? EdurekaEdureka!
 
DWX 2013 Nuremberg
DWX 2013 NurembergDWX 2013 Nuremberg
DWX 2013 NurembergMarcel Bruch
 
Jump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design PatternJump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design PatternNishith Shukla
 
Jump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsJump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsLalit Kale
 
Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!olracoatalub
 
Visualization of Complex Systems
Visualization of Complex SystemsVisualization of Complex Systems
Visualization of Complex SystemsChris Laffra
 
ActionScript Design Patterns
ActionScript Design Patterns ActionScript Design Patterns
ActionScript Design Patterns Yoss Cohen
 
From Duke of DevOps to Queen of Chaos - Api days 2018
From Duke of DevOps to Queen of Chaos - Api days 2018From Duke of DevOps to Queen of Chaos - Api days 2018
From Duke of DevOps to Queen of Chaos - Api days 2018Christophe Rochefolle
 
DockerCon SF 2015: Keynote Day 1
DockerCon SF 2015: Keynote Day 1DockerCon SF 2015: Keynote Day 1
DockerCon SF 2015: Keynote Day 1Docker, Inc.
 
Elm & Elixir: Functional Programming and Web
Elm & Elixir: Functional Programming and WebElm & Elixir: Functional Programming and Web
Elm & Elixir: Functional Programming and WebPublitory
 
The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008Stephan Chenette
 
Moving towards Reactive Programming
Moving towards Reactive ProgrammingMoving towards Reactive Programming
Moving towards Reactive ProgrammingDeepak Shevani
 
Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1benDesigning
 
Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1ReKruiTIn.com
 

Similar to My elixir helWo lorld (20)

The Taming Of The Code
The Taming Of The CodeThe Taming Of The Code
The Taming Of The Code
 
Tortuga-A simulation software
Tortuga-A simulation softwareTortuga-A simulation software
Tortuga-A simulation software
 
How to use Artificial Intelligence with Python? Edureka
How to use Artificial Intelligence with Python? EdurekaHow to use Artificial Intelligence with Python? Edureka
How to use Artificial Intelligence with Python? Edureka
 
DevOps 201607
DevOps 201607 DevOps 201607
DevOps 201607
 
Why test with flex unit
Why test with flex unitWhy test with flex unit
Why test with flex unit
 
DWX 2013 Nuremberg
DWX 2013 NurembergDWX 2013 Nuremberg
DWX 2013 Nuremberg
 
Jump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design PatternJump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design Pattern
 
Jump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsJump Start To Ooad And Design Patterns
Jump Start To Ooad And Design Patterns
 
Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!
 
Visualization of Complex Systems
Visualization of Complex SystemsVisualization of Complex Systems
Visualization of Complex Systems
 
ActionScript Design Patterns
ActionScript Design Patterns ActionScript Design Patterns
ActionScript Design Patterns
 
From Duke of DevOps to Queen of Chaos - Api days 2018
From Duke of DevOps to Queen of Chaos - Api days 2018From Duke of DevOps to Queen of Chaos - Api days 2018
From Duke of DevOps to Queen of Chaos - Api days 2018
 
Effective Java
Effective JavaEffective Java
Effective Java
 
DockerCon SF 2015: Keynote Day 1
DockerCon SF 2015: Keynote Day 1DockerCon SF 2015: Keynote Day 1
DockerCon SF 2015: Keynote Day 1
 
Elm & Elixir: Functional Programming and Web
Elm & Elixir: Functional Programming and WebElm & Elixir: Functional Programming and Web
Elm & Elixir: Functional Programming and Web
 
The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008
 
Moving towards Reactive Programming
Moving towards Reactive ProgrammingMoving towards Reactive Programming
Moving towards Reactive Programming
 
Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1
 
Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1
 
TxJS 2011
TxJS 2011TxJS 2011
TxJS 2011
 

Recently uploaded

Vishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsVishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsSachinPawar510423
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxsomshekarkn64
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptJasonTagapanGulla
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 

Recently uploaded (20)

Vishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsVishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documents
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptx
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.ppt
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 

My elixir helWo lorld

  • 1. My Elixir HelWo lolrd Why Elixir is the next big thing in tech world
  • 2. Claudio D’Alicandro AdEspresso By Hootsuite Twitter: @_cdali Github: claudio-dalicandro
  • 3. 19.000.000.000$ If you're thinking about WhatsApp, you're right... But what is behind a 19,000,000,000 dollars idea?
  • 4. A bit 'of numbers referring to WhatsApp 35 The engineers who worked for WhatsApp before acquisition 450.000.000 WhatsApp users before acquisition
  • 5. Erlang and the BEAM ● Light-weight process ● No memory sharing ● Code hot-swap out of the box ● Actor modeling ● Battle tested virtual machine
  • 6. My trouble with Erlang ● Prolog-inspired syntax ● Single assignment sometimes is just as problematic as destructive assignment ● Strings-as-lists sucks
  • 7. What if I told you that you can have all the advantages, and no flaws?
  • 10. mix Mix is a build tool that provides tasks for creating, compiling, and testing Elixir projects, managing its dependencies, and more.
  • 11. Mix Create an Elixir project is simple: $ mix new helwo_lorld --module HW
  • 13. ExUnit ● Simple macros help defining readable tests ● ExUnit.DocTest implements functionality similar to Python’s doctest. ● ExUnit.Callbacks defines both setup_all and setup callbacks, as well as the on_exit/2 facility ● You can define the test as asynchronous by adding “async: true” in the use statement
  • 14. Credo A static code analysis tool for the Elixir language with a focus on teaching and code consistency.
  • 15. Credo ● shows you refactoring opportunities in your code ● shows complex or duplicated code fragments ● warns you about common mistakes ● shows inconsistencies in your naming scheme ● helps you enforce a desired coding style
  • 18. Elixir Basic types ● Integer ● Float ● Boolean ● Atom ● String ● List ● Tuple
  • 19. Keyword lists A keyword list is a list of tuples
  • 20. Maps A map can be “updated” A map can be destructured through pattern matching
  • 22. What is the pattern matching? Actually, your “=” operator sucks.
  • 23. Destructuring You can use the pattern matching to destructure the input of a function
  • 25. Guards Clauses also allow extra conditions to be specified via guards
  • 26. Polymorphism Finally, it is important to specify that by using pattern matching you can implement polymorphism, indeed, you can set the same function multiple times, so as to cover different patterns with different behaviors
  • 28. Spawn a process In Elixir, all code runs inside processes. Processes are isolated from each other, run concurrent to one another and communicate via message passing. Processes are not only the basis for concurrency in Elixir, but they also provide the means for building distributed and fault-tolerant programs.
  • 29. Link and Monitoring The majority of times we spawn processes in Elixir, we spawn them as linked processes. When two process are linked the failure in one process propagates to the other. Finally, we can set up a monitor so that the parent process will receive a notification every time a child exits
  • 30. Why processes are so important? Obviously the processes are primarily a tool to perform parallel computations, but thanks to the BEAM and the infinite number of processes that can run on the inside, they have become something more…
  • 32. OTP No, this not means one time password The Open Telecom Platform is a collection of Middleware, libraries and tools
  • 33. Tasks, Agents, GenServers, GenEvents... Tasks meant to execute one particular action throughout their lifetime, often with little or no communication with other processes. store state that must be accessed from different processes Agents standard set of interface functions,include functionalities for tracing and error reporting GenServers event manager process with an arbitrary number of event handlers which are added and deleted dynamically GenEvents