SlideShare une entreprise Scribd logo
1  sur  35
Télécharger pour lire hors ligne
A sip of Elixir
@emadb
What language is this?
Erlang
• 1987 - First version written in Prolog.
Good but slow
• Early ’90 - BEAM
• 1992 - Erlang in production
• In 1998 Ericsson announced the
AXD301 switch, containing over a
million lines of Erlang and reported to
achieve a high availability of nine “9"s.
• 1999 Ericsson banned the use of
Erlang
• 2004 Ericsson lifted the ban
Erlang
Concurrency Oriented
Programming Languages
COP Languages
In languages like <noname> they forgot about concurrency. It either
wasn’t designed in from the beginning or else it was added on as an
afterthought.

Armstrong, 2002
COP Languages
• Processes are truly independent
• No penalty for massive parallelism
• No unavoidable penalty for distribution
• Concurrent behaviour of program same on all OSs
• Can deal with failure
COP is nice
• The world is parallel
• The world is distributed
• Things fail
• Make more powerful by adding more processors
• Our brain intuitively understand parallelism
Erlang is COP
Open Telecom Platform
• Delivered with Erlang and written in Erlang, it contains:
• an Erlang interpreter (which is called BEAM)
• an Erlang compiler
• a protocol for communication between servers (nodes)
• An Object Request Broker
• a static analysis tool called Dialyzer
• a distributed database server (Mnesia)
• many other libraries and utilities
Elixir
• R&D project form
Plataformatec (2011)
• His goals were to enable
higher extensibility and
productivity in the
Erlang VM while keeping
compatibility with
Erlang's ecosystem
Features
• Compiles to bytecode for the BEAM
• Functional language, everything is an expression
• Erlang functions can be called without costs
• Metaprogramming with macros
• Polymorphism via a mechanism called protocols and
behaviours
• Pattern matching
• Expressive language that programmers love (like Ruby!)
Elixir today
• Version 1.6.5
• New version every 6 months (1.7 in July)
• Hex package management (~6k packages)
• Vibrant community
A tour of the language
Processes
• Everything runs in a process
• Process is isolated
• Process communicate using messages
• Inside a process code runs in a single thread
GenServer
• The basic behaviour for a general purpose process
• Has state
• A “public interface” (client api vs. server callbacks)
• Callbacks to handle messages and send responses
• Terminate callback
GenServer
• init(args) :: {:ok, state}

A sort of “constructor” for the server
• handle_call(request, from, state) ::
{:reply, reply, new_state}

Handle synchronous messages
• handle_cast(request, state) :: {:noreply,
new_state}

Handle asynchronous messages
Redux?
GenServer and…
• GenStage: Producer-Consumer pipelines
• GenStatem: Event driven state machine
• Agent: State management
Actor model
• GenServer is the basic block for the actor model
• Code inside GenServer is single thread
• GenServer has it’s own message queue
• GenServer can create other Genservers
Supervisor
• A process to monitor other processes
• Handle failures and restarts child as needed
Supervisor
• Restarting strategy
• :one_for_one - if a child process terminates, only
that process is restarted.
• :one_for_all - if a child process terminates, all other
child processes are terminated and then all child
processes are restarted.
• :rest_for_one - if a child process terminates, the
“rest” of the child processes are terminated. Then the
terminated child process and the rest of the child
processes are restarted.
Applications
• Applications are a bundle of sub-application
• Application consists of a manifest
• Dependencies are sub-application
• Usually it starts the main supervisors and the
dependent applications
Other gems
• Macros
• Hot code swapping
• Umbrella projects
• Remote debugging and inspection
• Community ❤
Tooling
• mix is rake for Elixir
• https://hex.pm is the package registry
• Spec and Dyalizer
• Release with distillery (erts inside…no
prerequisites!)
Libraries and
Frameworks
Phoenix
Ecto
Nerves
Absinthe
Online Multiplayer game
In few lines of Elixir
Mars Rovers
Application
RoverSup
rover_1 rover_2 rover_n
WorldMap
Is it production ready?
FAQ
• Should I learn Erlang to use Elixir?
• Is it fast?
• To spawn or not to spawn?
• Does it run on windows?
Thank you

Contenu connexe

Tendances

JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...
JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...
JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...jazoon13
 
Clojure's take on concurrency
Clojure's take on concurrencyClojure's take on concurrency
Clojure's take on concurrencyyoavrubin
 
Kubernetes: The Very Hard Way
Kubernetes: The Very Hard WayKubernetes: The Very Hard Way
Kubernetes: The Very Hard WayRob Boll
 
.Net framework
.Net framework.Net framework
.Net frameworksanya6900
 
SyPy IronPython
SyPy IronPythonSyPy IronPython
SyPy IronPythonNick Hodge
 
.Net overview
.Net overview.Net overview
.Net overviewmadydud
 
Parallel language and compiler
Parallel language and compilerParallel language and compiler
Parallel language and compilerSVijaylakshmi
 
ScalaClean at ScalaSphere 2019
ScalaClean at ScalaSphere 2019ScalaClean at ScalaSphere 2019
ScalaClean at ScalaSphere 2019Rory Graves
 
The Spoofax Language Workbench (SPLASH 2010)
The Spoofax Language Workbench (SPLASH 2010)The Spoofax Language Workbench (SPLASH 2010)
The Spoofax Language Workbench (SPLASH 2010)lennartkats
 
Translating Apereo Software: A Case Study using Sakai and Transifex
Translating Apereo Software:  A Case Study using Sakai and TransifexTranslating Apereo Software:  A Case Study using Sakai and Transifex
Translating Apereo Software: A Case Study using Sakai and Transifexyuji tokiwa
 
Interpreters & Debuggers
Interpreters  &  DebuggersInterpreters  &  Debuggers
Interpreters & DebuggersMalek Sumaiya
 
Assmbly language mcqs
Assmbly language mcqsAssmbly language mcqs
Assmbly language mcqssunil kumar
 
Desarrollo multiplataforma con el framework .net
Desarrollo multiplataforma con el framework .netDesarrollo multiplataforma con el framework .net
Desarrollo multiplataforma con el framework .netDan Ardelean
 

Tendances (20)

JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...
JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...
JAZOON'13 - Nikita Salnikov-Tarnovski - Multiplatform Java application develo...
 
Clojure's take on concurrency
Clojure's take on concurrencyClojure's take on concurrency
Clojure's take on concurrency
 
.NET Framework
.NET Framework.NET Framework
.NET Framework
 
Kubernetes: The Very Hard Way
Kubernetes: The Very Hard WayKubernetes: The Very Hard Way
Kubernetes: The Very Hard Way
 
Microsoft .Net Technology
Microsoft .Net TechnologyMicrosoft .Net Technology
Microsoft .Net Technology
 
Evalution about programming language part 1
Evalution about programming language part 1Evalution about programming language part 1
Evalution about programming language part 1
 
Advanced AOP
Advanced AOPAdvanced AOP
Advanced AOP
 
.Net overview by cetpa
.Net overview by cetpa.Net overview by cetpa
.Net overview by cetpa
 
.Net framework
.Net framework.Net framework
.Net framework
 
SyPy IronPython
SyPy IronPythonSyPy IronPython
SyPy IronPython
 
.Net overview
.Net overview.Net overview
.Net overview
 
Parallel language and compiler
Parallel language and compilerParallel language and compiler
Parallel language and compiler
 
Why Kotlin?
Why Kotlin?Why Kotlin?
Why Kotlin?
 
Net overview
Net overviewNet overview
Net overview
 
ScalaClean at ScalaSphere 2019
ScalaClean at ScalaSphere 2019ScalaClean at ScalaSphere 2019
ScalaClean at ScalaSphere 2019
 
The Spoofax Language Workbench (SPLASH 2010)
The Spoofax Language Workbench (SPLASH 2010)The Spoofax Language Workbench (SPLASH 2010)
The Spoofax Language Workbench (SPLASH 2010)
 
Translating Apereo Software: A Case Study using Sakai and Transifex
Translating Apereo Software:  A Case Study using Sakai and TransifexTranslating Apereo Software:  A Case Study using Sakai and Transifex
Translating Apereo Software: A Case Study using Sakai and Transifex
 
Interpreters & Debuggers
Interpreters  &  DebuggersInterpreters  &  Debuggers
Interpreters & Debuggers
 
Assmbly language mcqs
Assmbly language mcqsAssmbly language mcqs
Assmbly language mcqs
 
Desarrollo multiplataforma con el framework .net
Desarrollo multiplataforma con el framework .netDesarrollo multiplataforma con el framework .net
Desarrollo multiplataforma con el framework .net
 

Similaire à A sip of Elixir

Repeating History...On Purpose...with Elixir
Repeating History...On Purpose...with ElixirRepeating History...On Purpose...with Elixir
Repeating History...On Purpose...with ElixirBarry Jones
 
Erlang factory SF 2011 "Erlang and the big switch in social games"
Erlang factory SF 2011 "Erlang and the big switch in social games"Erlang factory SF 2011 "Erlang and the big switch in social games"
Erlang factory SF 2011 "Erlang and the big switch in social games"Paolo Negri
 
Erlang, the big switch in social games
Erlang, the big switch in social gamesErlang, the big switch in social games
Erlang, the big switch in social gamesWooga
 
Erlang workshopdrammen
Erlang workshopdrammenErlang workshopdrammen
Erlang workshopdrammenReidar Sollid
 
Intro to elixir and phoenix
Intro to elixir and phoenixIntro to elixir and phoenix
Intro to elixir and phoenixJared Smith
 
Linux operating system by Quontra Solutions
Linux operating system by Quontra SolutionsLinux operating system by Quontra Solutions
Linux operating system by Quontra SolutionsQUONTRASOLUTIONS
 
11 scripting languages
11 scripting languages11 scripting languages
11 scripting languagescherrybear2014
 
Julia Computing - an alternative to Hadoop
Julia Computing - an alternative to HadoopJulia Computing - an alternative to Hadoop
Julia Computing - an alternative to HadoopShaurya Shekhar
 
Phoenix for Rubyists
Phoenix for RubyistsPhoenix for Rubyists
Phoenix for RubyistsDoug Goldie
 
computer languages
computer languagescomputer languages
computer languagesRajendran
 
Real World Elixir Deployment
Real World Elixir DeploymentReal World Elixir Deployment
Real World Elixir DeploymentPete Gamache
 
Writing Well-Behaved Unix Utilities
Writing Well-Behaved Unix UtilitiesWriting Well-Behaved Unix Utilities
Writing Well-Behaved Unix UtilitiesRob Miller
 
Elixir Programming Language 101
Elixir Programming Language 101Elixir Programming Language 101
Elixir Programming Language 101Around25
 
Week 08_Basics of Compiler Construction.pdf
Week 08_Basics of Compiler Construction.pdfWeek 08_Basics of Compiler Construction.pdf
Week 08_Basics of Compiler Construction.pdfAnonymousQ3EMYoWNS
 
PCSG_Computer_Science_Unit_1_Lecture_2.pptx
PCSG_Computer_Science_Unit_1_Lecture_2.pptxPCSG_Computer_Science_Unit_1_Lecture_2.pptx
PCSG_Computer_Science_Unit_1_Lecture_2.pptxAliyahAli19
 

Similaire à A sip of Elixir (20)

Repeating History...On Purpose...with Elixir
Repeating History...On Purpose...with ElixirRepeating History...On Purpose...with Elixir
Repeating History...On Purpose...with Elixir
 
Erlang factory SF 2011 "Erlang and the big switch in social games"
Erlang factory SF 2011 "Erlang and the big switch in social games"Erlang factory SF 2011 "Erlang and the big switch in social games"
Erlang factory SF 2011 "Erlang and the big switch in social games"
 
Erlang, the big switch in social games
Erlang, the big switch in social gamesErlang, the big switch in social games
Erlang, the big switch in social games
 
Erlang/Elixir and OTP
Erlang/Elixir and OTPErlang/Elixir and OTP
Erlang/Elixir and OTP
 
Erlang workshopdrammen
Erlang workshopdrammenErlang workshopdrammen
Erlang workshopdrammen
 
Intro to elixir and phoenix
Intro to elixir and phoenixIntro to elixir and phoenix
Intro to elixir and phoenix
 
Introduction to multicore .ppt
Introduction to multicore .pptIntroduction to multicore .ppt
Introduction to multicore .ppt
 
Linux operating system by Quontra Solutions
Linux operating system by Quontra SolutionsLinux operating system by Quontra Solutions
Linux operating system by Quontra Solutions
 
11 scripting languages
11 scripting languages11 scripting languages
11 scripting languages
 
Julia Computing - an alternative to Hadoop
Julia Computing - an alternative to HadoopJulia Computing - an alternative to Hadoop
Julia Computing - an alternative to Hadoop
 
Phoenix for Rubyists
Phoenix for RubyistsPhoenix for Rubyists
Phoenix for Rubyists
 
computer languages
computer languagescomputer languages
computer languages
 
Real World Elixir Deployment
Real World Elixir DeploymentReal World Elixir Deployment
Real World Elixir Deployment
 
MPI, Erlang and the web
MPI, Erlang and the webMPI, Erlang and the web
MPI, Erlang and the web
 
Writing Well-Behaved Unix Utilities
Writing Well-Behaved Unix UtilitiesWriting Well-Behaved Unix Utilities
Writing Well-Behaved Unix Utilities
 
Erlang os
Erlang osErlang os
Erlang os
 
Elixir Programming Language 101
Elixir Programming Language 101Elixir Programming Language 101
Elixir Programming Language 101
 
Week 08_Basics of Compiler Construction.pdf
Week 08_Basics of Compiler Construction.pdfWeek 08_Basics of Compiler Construction.pdf
Week 08_Basics of Compiler Construction.pdf
 
PCSG_Computer_Science_Unit_1_Lecture_2.pptx
PCSG_Computer_Science_Unit_1_Lecture_2.pptxPCSG_Computer_Science_Unit_1_Lecture_2.pptx
PCSG_Computer_Science_Unit_1_Lecture_2.pptx
 
Elixir
ElixirElixir
Elixir
 

Plus de Emanuele DelBono

Plus de Emanuele DelBono (13)

The simplest thing that could possibly work
The simplest thing that could possibly workThe simplest thing that could possibly work
The simplest thing that could possibly work
 
Una crescita armoniosa
Una crescita armoniosaUna crescita armoniosa
Una crescita armoniosa
 
React.js in real world apps.
React.js in real world apps. React.js in real world apps.
React.js in real world apps.
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.js
 
From ActiveRecord to EventSourcing
From ActiveRecord to EventSourcingFrom ActiveRecord to EventSourcing
From ActiveRecord to EventSourcing
 
Ruby seen by a C# developer
Ruby seen by a C# developerRuby seen by a C# developer
Ruby seen by a C# developer
 
Ruby loves DDD
Ruby loves DDDRuby loves DDD
Ruby loves DDD
 
An introduction to knockout.js
An introduction to knockout.jsAn introduction to knockout.js
An introduction to knockout.js
 
Node azure
Node azureNode azure
Node azure
 
Da programmatore a CEO
Da programmatore a CEODa programmatore a CEO
Da programmatore a CEO
 
Sinatra for REST services
Sinatra for REST servicesSinatra for REST services
Sinatra for REST services
 
Test driving an MVVM App
Test driving an MVVM AppTest driving an MVVM App
Test driving an MVVM App
 
Mocking
MockingMocking
Mocking
 

Dernier

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Dernier (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

A sip of Elixir

  • 1. A sip of Elixir @emadb
  • 3. Erlang • 1987 - First version written in Prolog. Good but slow • Early ’90 - BEAM • 1992 - Erlang in production • In 1998 Ericsson announced the AXD301 switch, containing over a million lines of Erlang and reported to achieve a high availability of nine “9"s. • 1999 Ericsson banned the use of Erlang • 2004 Ericsson lifted the ban
  • 6. COP Languages In languages like <noname> they forgot about concurrency. It either wasn’t designed in from the beginning or else it was added on as an afterthought.
 Armstrong, 2002
  • 7. COP Languages • Processes are truly independent • No penalty for massive parallelism • No unavoidable penalty for distribution • Concurrent behaviour of program same on all OSs • Can deal with failure
  • 8. COP is nice • The world is parallel • The world is distributed • Things fail • Make more powerful by adding more processors • Our brain intuitively understand parallelism
  • 10. Open Telecom Platform • Delivered with Erlang and written in Erlang, it contains: • an Erlang interpreter (which is called BEAM) • an Erlang compiler • a protocol for communication between servers (nodes) • An Object Request Broker • a static analysis tool called Dialyzer • a distributed database server (Mnesia) • many other libraries and utilities
  • 11.
  • 12. Elixir • R&D project form Plataformatec (2011) • His goals were to enable higher extensibility and productivity in the Erlang VM while keeping compatibility with Erlang's ecosystem
  • 13. Features • Compiles to bytecode for the BEAM • Functional language, everything is an expression • Erlang functions can be called without costs • Metaprogramming with macros • Polymorphism via a mechanism called protocols and behaviours • Pattern matching • Expressive language that programmers love (like Ruby!)
  • 14. Elixir today • Version 1.6.5 • New version every 6 months (1.7 in July) • Hex package management (~6k packages) • Vibrant community
  • 15. A tour of the language
  • 16. Processes • Everything runs in a process • Process is isolated • Process communicate using messages • Inside a process code runs in a single thread
  • 17. GenServer • The basic behaviour for a general purpose process • Has state • A “public interface” (client api vs. server callbacks) • Callbacks to handle messages and send responses • Terminate callback
  • 18. GenServer • init(args) :: {:ok, state}
 A sort of “constructor” for the server • handle_call(request, from, state) :: {:reply, reply, new_state}
 Handle synchronous messages • handle_cast(request, state) :: {:noreply, new_state}
 Handle asynchronous messages Redux?
  • 19. GenServer and… • GenStage: Producer-Consumer pipelines • GenStatem: Event driven state machine • Agent: State management
  • 20. Actor model • GenServer is the basic block for the actor model • Code inside GenServer is single thread • GenServer has it’s own message queue • GenServer can create other Genservers
  • 21. Supervisor • A process to monitor other processes • Handle failures and restarts child as needed
  • 22. Supervisor • Restarting strategy • :one_for_one - if a child process terminates, only that process is restarted. • :one_for_all - if a child process terminates, all other child processes are terminated and then all child processes are restarted. • :rest_for_one - if a child process terminates, the “rest” of the child processes are terminated. Then the terminated child process and the rest of the child processes are restarted.
  • 23. Applications • Applications are a bundle of sub-application • Application consists of a manifest • Dependencies are sub-application • Usually it starts the main supervisors and the dependent applications
  • 24. Other gems • Macros • Hot code swapping • Umbrella projects • Remote debugging and inspection • Community ❤
  • 25. Tooling • mix is rake for Elixir • https://hex.pm is the package registry • Spec and Dyalizer • Release with distillery (erts inside…no prerequisites!)
  • 28. Ecto
  • 31. Online Multiplayer game In few lines of Elixir
  • 34. FAQ • Should I learn Erlang to use Elixir? • Is it fast? • To spawn or not to spawn? • Does it run on windows?