SlideShare a Scribd company logo
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

More Related Content

PDF
Erlang workshopdrammen
ODP
Concurrent programming
PPTX
Tech Days 2015: CodePeer - Introduction and Examples of Use
PPT
Tech Days 2015: A quick tour of Ada 2012
PPTX
Tech Days 2015: Static Analysis CodePeer
PPTX
Introduction to Erlang Programming Language
PDF
Understanding Implicits in Scala
PPTX
Programming in python w6
Erlang workshopdrammen
Concurrent programming
Tech Days 2015: CodePeer - Introduction and Examples of Use
Tech Days 2015: A quick tour of Ada 2012
Tech Days 2015: Static Analysis CodePeer
Introduction to Erlang Programming Language
Understanding Implicits in Scala
Programming in python w6

What's hot (20)

PPTX
Flex (fast lexical analyzer generator )
PDF
Glusterfs session #11 locks xlator entrylks
PDF
Glusterfs session #12 locks xlator posixlk
PPT
Assic 8th Lecture
PPTX
Chapter one
PPTX
Monolithic and Procedural Programming
DOCX
Notes of Important Programming Fundamental Questions
ODP
ANTLR4 and its testing
ODP
Using ANTLR on real example - convert "string combined" queries into paramete...
ODP
PDF
Functional programming in Scala
PPTX
Not all objects are equal - strategies for designing testable code
PDF
Beyond Fault Tolerance with Actor Programming
PPT
Utilize Jericho HTML Parser to Resolve NCR Problem
PDF
Erlang sem enrolação
PDF
Stairway to scala flyer
PPTX
Introduction to Functional programming
PPTX
Introduction ,characteristics, properties,pseudo code conventions
PPTX
PDF
JDT embraces lambda expressions
Flex (fast lexical analyzer generator )
Glusterfs session #11 locks xlator entrylks
Glusterfs session #12 locks xlator posixlk
Assic 8th Lecture
Chapter one
Monolithic and Procedural Programming
Notes of Important Programming Fundamental Questions
ANTLR4 and its testing
Using ANTLR on real example - convert "string combined" queries into paramete...
Functional programming in Scala
Not all objects are equal - strategies for designing testable code
Beyond Fault Tolerance with Actor Programming
Utilize Jericho HTML Parser to Resolve NCR Problem
Erlang sem enrolação
Stairway to scala flyer
Introduction to Functional programming
Introduction ,characteristics, properties,pseudo code conventions
JDT embraces lambda expressions
Ad

Similar to Elixir otp-basics (20)

PDF
Elixir – Peeking into Elixir's Processes, OTP and Supervisors
PDF
Erlang/Elixir and OTP
PDF
Elixir and OTP
PDF
Introducing Elixir and OTP at the Erlang BASH
PDF
Elixir
PPTX
Repeating History...On Purpose...with Elixir
PDF
Concurrency, Robustness & Elixir SoCraTes 2015
PDF
Learning Elixir as a Rubyist
PDF
Elixir and OTP Apps introduction
PDF
Introduction to Erlang/(Elixir) at a Webilea Hands-On Session
PPTX
Elixir and OTP
PDF
Introduction to Elixir
PDF
My elixir helWo lorld
PDF
Introdução à Elixir
PDF
Yurii Bodarev - OTP, Phoenix & Ecto: Three Pillars of Elixir
PPTX
PDF
Elixir and elm
PDF
外傷的Elixir
PDF
Elixir Programming Language 101
PDF
Programming Elixir 13 Functional Concurrent Pragmatic Fun Dave Thomas
Elixir – Peeking into Elixir's Processes, OTP and Supervisors
Erlang/Elixir and OTP
Elixir and OTP
Introducing Elixir and OTP at the Erlang BASH
Elixir
Repeating History...On Purpose...with Elixir
Concurrency, Robustness & Elixir SoCraTes 2015
Learning Elixir as a Rubyist
Elixir and OTP Apps introduction
Introduction to Erlang/(Elixir) at a Webilea Hands-On Session
Elixir and OTP
Introduction to Elixir
My elixir helWo lorld
Introdução à Elixir
Yurii Bodarev - OTP, Phoenix & Ecto: Three Pillars of Elixir
Elixir and elm
外傷的Elixir
Elixir Programming Language 101
Programming Elixir 13 Functional Concurrent Pragmatic Fun Dave Thomas
Ad

More from Ruben Amortegui (8)

PDF
Working with-phoenix
ODP
Elixir koans
ODP
Elixir absinthe-basics
ODP
Phoenix basics
ODP
Elixir basics-2
ODP
Elixir basics
ODP
From Perl To Elixir
Working with-phoenix
Elixir koans
Elixir absinthe-basics
Phoenix basics
Elixir basics-2
Elixir basics
From Perl To Elixir

Recently uploaded (20)

PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
history of c programming in notes for students .pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Nekopoi APK 2025 free lastest update
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
System and Network Administration Chapter 2
PPTX
L1 - Introduction to python Backend.pptx
VVF-Customer-Presentation2025-Ver1.9.pptx
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
history of c programming in notes for students .pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Nekopoi APK 2025 free lastest update
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Operating system designcfffgfgggggggvggggggggg
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Odoo POS Development Services by CandidRoot Solutions
Softaken Excel to vCard Converter Software.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
System and Network Administration Chapter 2
L1 - Introduction to python Backend.pptx

Elixir otp-basics