SlideShare uma empresa Scribd logo
1 de 29
Ruben Amortegui
@ramortegui
http://rubenamortegui.com
https://github.com/ramortegui
OTP - Basics
Agenda
– OTP
– Concepts
– OTP Basics
● GenServer
● Supervisor
● Application
– Case EcCart
– Summary
Elixir – OTP
● OTP stands for Open Telecom Platform.
● Is a general purpose tool for developing and
managing large systems.
● Provides tools, libraries, conventions and
defines a structure for your application.
Elixir – About OTP
● Features included in Erlang/Elixir/OTP:
– Erlang interpreter and compiler
– Standard libraries
– Dialyzer, a static analysis tool
– Mnesia, a distributed database
– Erlang Term Storage (ETS)
– A debugger
– An event tracer
– A release management tool (hot swap)
Elixir – Concepts
● Process
– Fundamental part of concurrency
– Are light weight
– Doesn’t share memory
– Implemented using tail recursion
Taken from: http://learnyousomeerlang.com/event-handlers
Elixir – Concepts
● Process
Elixir – Concepts
● Process (recap spawn, spawn_link )
Elixir – Concepts
● Behaviours
– Code that implements a common pattern.
– OTP provides:
● GenServer
● Supervisor
● Application
Elixir – About OTP
Sup
Elixir – About OTP
Sup
SubSup
Elixir – About OTP
Sup
SubSup Worker
Elixir – About OTP
Sup
SubSup Worker
SubSupSup
Elixir – About OTP
Sup
SubSup Worker
SubSubSup
Worker
Elixir – About OTP
Sup
SubSup Worker
SubSubSup
Worker Worker Worker
Worker
Elixir – About OTP
● Erlang implements Actor model
– Actor can communicate with others by messages.
– Actor encapsulates the state.
– When and Actor is processing messages, the actor
can designate a new state.
Elixir – OTP case
● Use a calculator of example of how can evolve
on a basic OTP architecture.
Elixir – Script Calculator
Elixir – Script Calculator
● Issues
– Doesn’t maintain state
– No communicaton with other processes
Elixir – Module Calculator
Elixir – Module Calculator
● Maintain state
● Communication with other processes
● What is missing?
– Message Box
– Naming
– Distribution
– Concurrency
– Fault Tolerance/recovery
Elixir – GenServer
● Provides callback functions
● Manage inbox messages
● Alias registration
● Integration with OTP behaviours
Elixir – GenServer
●
Elixir – GenServer Calculator
Elixir – Supervisor Calculator
Elixir – Application Calculator
Elixir – Summary
• OTP is easy to implement.
● OTP behaviours has been battle tested for
years.
● The behaviours on OTP makes hard tasks
really easy.
Elixir – EcCart
● https://hex.pm/packages/ec_cart
References
●
NY: Manning Publications.
● Thomas, D. (2016). Programming Elixir 1.3:
functional, concurrent, pragmatic, fun. Releigh,
NC: Pragmatic Bookshelf.
● Tan Wei Hao, B.(2017). The little Elixir & OTP
Guidebook. Shelter Island, NY: Manning
Publications.
Thanks!
Q & A?
@ramortegui
http://rubenamortegui.com
https://github.com/ramortegui

Mais conteúdo relacionado

Mais procurados

Utilize Jericho HTML Parser to Resolve NCR Problem
Utilize Jericho HTML Parser to Resolve NCR ProblemUtilize Jericho HTML Parser to Resolve NCR Problem
Utilize Jericho HTML Parser to Resolve NCR Problem
Guo Albert
 

Mais procurados (20)

Flex (fast lexical analyzer generator )
Flex (fast lexical analyzer generator )Flex (fast lexical analyzer generator )
Flex (fast lexical analyzer generator )
 
Glusterfs session #11 locks xlator entrylks
Glusterfs session #11   locks xlator entrylksGlusterfs session #11   locks xlator entrylks
Glusterfs session #11 locks xlator entrylks
 
Glusterfs session #12 locks xlator posixlk
Glusterfs session #12   locks xlator posixlkGlusterfs session #12   locks xlator posixlk
Glusterfs session #12 locks xlator posixlk
 
Assic 8th Lecture
Assic 8th LectureAssic 8th Lecture
Assic 8th Lecture
 
Chapter one
Chapter oneChapter one
Chapter one
 
Monolithic and Procedural Programming
Monolithic and Procedural ProgrammingMonolithic and Procedural Programming
Monolithic and Procedural Programming
 
Notes of Important Programming Fundamental Questions
Notes of Important Programming Fundamental QuestionsNotes of Important Programming Fundamental Questions
Notes of Important Programming Fundamental Questions
 
ANTLR4 and its testing
ANTLR4 and its testingANTLR4 and its testing
ANTLR4 and its testing
 
Using ANTLR on real example - convert "string combined" queries into paramete...
Using ANTLR on real example - convert "string combined" queries into paramete...Using ANTLR on real example - convert "string combined" queries into paramete...
Using ANTLR on real example - convert "string combined" queries into paramete...
 
ANTLR4 in depth
ANTLR4 in depthANTLR4 in depth
ANTLR4 in depth
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scala
 
Not all objects are equal - strategies for designing testable code
Not all objects are equal - strategies for designing testable codeNot all objects are equal - strategies for designing testable code
Not all objects are equal - strategies for designing testable code
 
Beyond Fault Tolerance with Actor Programming
Beyond Fault Tolerance with Actor ProgrammingBeyond Fault Tolerance with Actor Programming
Beyond Fault Tolerance with Actor Programming
 
Utilize Jericho HTML Parser to Resolve NCR Problem
Utilize Jericho HTML Parser to Resolve NCR ProblemUtilize Jericho HTML Parser to Resolve NCR Problem
Utilize Jericho HTML Parser to Resolve NCR Problem
 
Erlang sem enrolação
Erlang sem enrolaçãoErlang sem enrolação
Erlang sem enrolação
 
Stairway to scala flyer
Stairway to scala flyerStairway to scala flyer
Stairway to scala flyer
 
Introduction to Functional programming
Introduction to Functional programmingIntroduction to Functional programming
Introduction to Functional programming
 
Introduction ,characteristics, properties,pseudo code conventions
Introduction ,characteristics, properties,pseudo code conventionsIntroduction ,characteristics, properties,pseudo code conventions
Introduction ,characteristics, properties,pseudo code conventions
 
Ajax
AjaxAjax
Ajax
 
JDT embraces lambda expressions
JDT embraces lambda expressionsJDT embraces lambda expressions
JDT embraces lambda expressions
 

Semelhante a Elixir otp-basics

DevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 SlidesDevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 Slides
Alex Cruise
 

Semelhante a Elixir otp-basics (20)

Elixir
ElixirElixir
Elixir
 
Reactive Software Systems
Reactive Software SystemsReactive Software Systems
Reactive Software Systems
 
Erlang/Elixir and OTP
Erlang/Elixir and OTPErlang/Elixir and OTP
Erlang/Elixir and OTP
 
Introdução à Elixir
Introdução à ElixirIntrodução à Elixir
Introdução à Elixir
 
Learning Elixir as a Rubyist
Learning Elixir as a RubyistLearning Elixir as a Rubyist
Learning Elixir as a Rubyist
 
Introduction to concurrent programming with akka actors
Introduction to concurrent programming with akka actorsIntroduction to concurrent programming with akka actors
Introduction to concurrent programming with akka actors
 
Introduction to concurrent programming with Akka actors
Introduction to concurrent programming with Akka actorsIntroduction to concurrent programming with Akka actors
Introduction to concurrent programming with Akka actors
 
Ecto
EctoEcto
Ecto
 
A sip of Elixir
A sip of ElixirA sip of Elixir
A sip of Elixir
 
Gatling
Gatling Gatling
Gatling
 
Performance Test Automation With Gatling
Performance Test Automation  With GatlingPerformance Test Automation  With Gatling
Performance Test Automation With Gatling
 
Repeating History...On Purpose...with Elixir
Repeating History...On Purpose...with ElixirRepeating History...On Purpose...with Elixir
Repeating History...On Purpose...with Elixir
 
New c sharp3_features_(linq)_part_iv
New c sharp3_features_(linq)_part_ivNew c sharp3_features_(linq)_part_iv
New c sharp3_features_(linq)_part_iv
 
Getting_Started_with_Salesforce_Flow_for_Developers_(In-person_event)_.pptx
Getting_Started_with_Salesforce_Flow_for_Developers_(In-person_event)_.pptxGetting_Started_with_Salesforce_Flow_for_Developers_(In-person_event)_.pptx
Getting_Started_with_Salesforce_Flow_for_Developers_(In-person_event)_.pptx
 
Memory models in c#
Memory models in c#Memory models in c#
Memory models in c#
 
Introduction to multicore .ppt
Introduction to multicore .pptIntroduction to multicore .ppt
Introduction to multicore .ppt
 
Osdc 2011 michael_neale
Osdc 2011 michael_nealeOsdc 2011 michael_neale
Osdc 2011 michael_neale
 
Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?
 
DevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 SlidesDevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 Slides
 
Introduction
IntroductionIntroduction
Introduction
 

Mais de Ruben Amortegui (7)

Working with-phoenix
Working with-phoenixWorking with-phoenix
Working with-phoenix
 
Elixir koans
Elixir koansElixir koans
Elixir koans
 
Elixir absinthe-basics
Elixir absinthe-basicsElixir absinthe-basics
Elixir absinthe-basics
 
Phoenix basics
Phoenix basicsPhoenix basics
Phoenix basics
 
Elixir basics-2
Elixir basics-2Elixir basics-2
Elixir basics-2
 
Elixir basics
Elixir basicsElixir basics
Elixir basics
 
From Perl To Elixir
From Perl To ElixirFrom Perl To Elixir
From Perl To Elixir
 

Último

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

%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
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
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
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

Elixir otp-basics