SlideShare a Scribd company logo
1 of 82
{
Erlang and gen_fsm
@dieswaytoofast
(V.P. Ubiquiti Networks)
The Business
The Metrics
 Phone Calls per Second
The Metrics
 Phone Calls per Second
The Metrics
x 1000
 Simultaneous Phone Calls
The Metrics
 Simultaneous Phone Calls
The Metrics
x 10,000
 HTTP API requests
The Metrics
 HTTP API requests
The Metrics
x ∞
 Self-hosted (kinda)
 Voice Response
Call Handling
init
Setup Call
Get Caller
Name
Play Transfer
Message
Got Caller
Name
Dial
 Call Routing
Call Handling
dial_in
Check
Blacklist
get_endpoint conference Play Error
Hangupauto_attendant
dial_in_fml conference
init
Check node
Check
Blacklist
Cancelled Blacklisted Next Endpoint Collections Unknown
Move node
Auto Attendant FML Voicemail FaxConference
 Self-hosted (kinda)
Bet the farm moment
ERLANG!!!
 Concurrency
The Big Six
From http://www.erlang.org/download/armstrong_thesis_2003.pdf
 Concurrency
 Error encapsulation
The Big Six
From http://www.erlang.org/download/armstrong_thesis_2003.pdf
 Concurrency
 Error encapsulation
 Fault detection
The Big Six
From http://www.erlang.org/download/armstrong_thesis_2003.pdf
 Concurrency
 Error encapsulation
 Fault detection
 Fault identification
The Big Six
From http://www.erlang.org/download/armstrong_thesis_2003.pdf
 Concurrency
 Error encapsulation
 Fault detection
 Fault identification
 Code upgrade
The Big Six
From http://www.erlang.org/download/armstrong_thesis_2003.pdf
 Concurrency
 Error encapsulation
 Fault detection
 Fault identification
 Code upgrade
 Stable Storage
The Big Six
From http://www.erlang.org/download/armstrong_thesis_2003.pdf
Erlang
Concurrency Hell
My Blue Heaven My Blue Heaven
Erlang
Concurrency Hell
My Blue Heaven
Deep Problems
My Blue Heaven
Deep Problems
 gen_server
Behaviours
 gen_server
 gen_tcp
Behaviours
 gen_server
 gen_tcp
 gen_event
Behaviours
 gen_server
 gen_tcp
 gen_event
 gen_fsm
Behaviours
 gen_server
 gen_tcp
 gen_event
 gen_fsm
 …
Behaviours
 gen_server
 gen_tcp
 gen_event
 gen_fsm
 …
Behaviours
 A System has States
Finite State Machines
asleepStart
out of
bed
Coffee!!
 A System has States
 States transition
Finite State Machines
asleepStart
out of
bed
Coffee!!
 A System has States
 States transition
 Transitions are Atomic
Finite State Machines
asleepStart
out of
bed
Coffee!!
NOTHING HERE
 A System has States
 States transition
 Transitions are Atomic
 Events at Entry and Exit
Finite State Machines
asleepStart
out of
bed
Riiiiiiiiing Brush Teeth
Coffee!!
asleepStart
out of
bed
Coffee!!
asleepStart
out of
bed
Riiiiiiiiing Brush Teeth
Coffee!!
asleepStart
out of
bed
Riiiiiiiiing Brush Teeth
Coffee!!
asleepStart
out of
bed
Coffee!!
asleepStart
out of
bed
Riiiiiiiiing Brush Teeth
Coffee!!
HUH?
asleepStart
out of
bed
Riiiiiiiiing Brush Teeth
Coffee!!
asleepStart
out of
bed
Riiiiiiiiing Brush Teeth
Coffee!!
W
00t!
Un-
Auth
Start
Token
Req.
Stop
Un-
Auth
Start
Token
Req.
Stop
Get
Request
Token
Get
Access
Token
Request
Token
Access
Token
Un-
Auth
Start
Token
Req.
Stop
Get
Request
Token
Get
Access
Token
Request
Token
Access
Token
Un-
Auth
Start
Token
Req.
Stop
Get
Request
Token
Get
Access
Token
Request
Token
Access
Token
Un-
Auth
Start
Token
Req.
Stop
Get
Request
Token
Get
Access
Token
Request
Token
Access
Token
Un-
Auth
Start
Token
Req.
Stop
Get
Request
Token
Get
Access
Token
Request
Token
Access
Token
Un-
Auth
Start
Token
Req.
Stop
Get
Request
Token
Get
Access
Token
Request
Token
Access
Token
Un-
Auth
Start
Token
Req.
Stop
Get
Request
Token
Get
Access
Token
Request
Token
Access
Token
Un-
Auth
Start
Token
Req.
Stop
Get
Request
Token
Get
Access
Token
Request
Token
Access
Token
 Everything is an FSM
Finite State Machines
 Everything is an FSM
Finite State Machines
COM
PLEXITY?
 Everything is an FSM
Finite State Machines
ENCAPSULATION!
 Voice Response
Finite State Machines
init
Setup Call
Get Caller
Name
Play Transfer
Message
Got Caller
Name
Dial
 Voice Response
Finite State Machines
init
Setup Call
Get Caller
Name
Play Transfer
Message
Got Caller
Name
Dial
 Voice Response
Finite State Machines
init
Setup Call
Get Caller
Name
Play Transfer
Message
Got Caller
Name
Dial
ENCAPSULATION!
Encapsulation
Concurrency Hell
My Blue Heaven
Deep Problems
My Blue Heaven
Deep Problems
 Call Routing
Finite State Machines
dial_in
Check
Blacklist
get_endpoint conference Play Error
Hangupauto_attendant
dial_in_fml conference
init
Check node
Check
Blacklist
Cancelled Blacklisted Next Endpoint Collections Unknown
Move node
Auto Attendant FML Voicemail FaxConference
 Templates are your friend
 So are BIG sheets of paper
 Think “Real World”
The Bottom Line
Finite State Machines - Why the fear?

More Related Content

Viewers also liked

Finite State Machine | Computer Science
Finite State Machine | Computer ScienceFinite State Machine | Computer Science
Finite State Machine | Computer ScienceTransweb Global Inc
 
OTP application (with gen server child) - simple example
OTP application (with gen server child) - simple exampleOTP application (with gen server child) - simple example
OTP application (with gen server child) - simple exampleYangJerng Hwa
 
Moore and Mealy machines
Moore and Mealy machinesMoore and Mealy machines
Moore and Mealy machinesIrfan Anjum
 
Introduction to Object Oriented Design
Introduction to Object Oriented DesignIntroduction to Object Oriented Design
Introduction to Object Oriented DesignOleg Yaroshevych
 
Sigma Knowledge Engineering Environment
Sigma Knowledge Engineering EnvironmentSigma Knowledge Engineering Environment
Sigma Knowledge Engineering EnvironmentKingsley Uyi Idehen
 
Object Oriented Design And Programing
Object Oriented Design And ProgramingObject Oriented Design And Programing
Object Oriented Design And ProgramingEmmanuel Fuchs
 
3.o o design -_____________lecture 3
3.o o design -_____________lecture 33.o o design -_____________lecture 3
3.o o design -_____________lecture 3Warui Maina
 
Solving a “Transportation Planning” Problem through the Programming Language “C”
Solving a “Transportation Planning” Problem through the Programming Language “C”Solving a “Transportation Planning” Problem through the Programming Language “C”
Solving a “Transportation Planning” Problem through the Programming Language “C”Shahadat Hossain Shakil
 
Mypresentation
MypresentationMypresentation
MypresentationSukh14
 
Structured systems analysis and design methodology
Structured systems analysis and design methodologyStructured systems analysis and design methodology
Structured systems analysis and design methodologyVatsana Technologies Pte Ltd
 
Problem solving using Computer
Problem solving using ComputerProblem solving using Computer
Problem solving using ComputerDavid Livingston J
 
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHYFINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHYnishimanglani
 
Visualization of Hajime Yoshino’s Logical Jurisprudence. IRIS 2017
Visualization of Hajime Yoshino’s Logical Jurisprudence. IRIS 2017Visualization of Hajime Yoshino’s Logical Jurisprudence. IRIS 2017
Visualization of Hajime Yoshino’s Logical Jurisprudence. IRIS 2017Vytautas Čyras
 
Machine Learning for Automated Reasoning: An Overview
Machine Learning for Automated Reasoning: An OverviewMachine Learning for Automated Reasoning: An Overview
Machine Learning for Automated Reasoning: An OverviewVincenzo Lomonaco
 
Artificial Intelligence
Artificial Intelligence Artificial Intelligence
Artificial Intelligence Muhammad Ahad
 

Viewers also liked (20)

Finite State Machine | Computer Science
Finite State Machine | Computer ScienceFinite State Machine | Computer Science
Finite State Machine | Computer Science
 
Cldch8
Cldch8Cldch8
Cldch8
 
OTP application (with gen server child) - simple example
OTP application (with gen server child) - simple exampleOTP application (with gen server child) - simple example
OTP application (with gen server child) - simple example
 
Moore and Mealy machines
Moore and Mealy machinesMoore and Mealy machines
Moore and Mealy machines
 
Introduction to Object Oriented Design
Introduction to Object Oriented DesignIntroduction to Object Oriented Design
Introduction to Object Oriented Design
 
Sigma Knowledge Engineering Environment
Sigma Knowledge Engineering EnvironmentSigma Knowledge Engineering Environment
Sigma Knowledge Engineering Environment
 
Slide 3 musfique
Slide 3 musfiqueSlide 3 musfique
Slide 3 musfique
 
Object Oriented Design And Programing
Object Oriented Design And ProgramingObject Oriented Design And Programing
Object Oriented Design And Programing
 
Thinking and language
Thinking and languageThinking and language
Thinking and language
 
Unit 1(stld)
Unit 1(stld)Unit 1(stld)
Unit 1(stld)
 
3.o o design -_____________lecture 3
3.o o design -_____________lecture 33.o o design -_____________lecture 3
3.o o design -_____________lecture 3
 
Solving a “Transportation Planning” Problem through the Programming Language “C”
Solving a “Transportation Planning” Problem through the Programming Language “C”Solving a “Transportation Planning” Problem through the Programming Language “C”
Solving a “Transportation Planning” Problem through the Programming Language “C”
 
Mypresentation
MypresentationMypresentation
Mypresentation
 
Structured systems analysis and design methodology
Structured systems analysis and design methodologyStructured systems analysis and design methodology
Structured systems analysis and design methodology
 
Problem solving using Computer
Problem solving using ComputerProblem solving using Computer
Problem solving using Computer
 
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHYFINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
 
Visualization of Hajime Yoshino’s Logical Jurisprudence. IRIS 2017
Visualization of Hajime Yoshino’s Logical Jurisprudence. IRIS 2017Visualization of Hajime Yoshino’s Logical Jurisprudence. IRIS 2017
Visualization of Hajime Yoshino’s Logical Jurisprudence. IRIS 2017
 
Machine Learning for Automated Reasoning: An Overview
Machine Learning for Automated Reasoning: An OverviewMachine Learning for Automated Reasoning: An Overview
Machine Learning for Automated Reasoning: An Overview
 
Deterministic Finite Automata
Deterministic Finite AutomataDeterministic Finite Automata
Deterministic Finite Automata
 
Artificial Intelligence
Artificial Intelligence Artificial Intelligence
Artificial Intelligence
 

More from Mahesh Paolini-Subramanya

More from Mahesh Paolini-Subramanya (10)

Drinking From The Firehose - The Erlang Way
Drinking From The Firehose - The Erlang WayDrinking From The Firehose - The Erlang Way
Drinking From The Firehose - The Erlang Way
 
Syntax - Why so CareMad?
Syntax - Why so CareMad?Syntax - Why so CareMad?
Syntax - Why so CareMad?
 
Erlang - Because S**t Happens
Erlang - Because S**t HappensErlang - Because S**t Happens
Erlang - Because S**t Happens
 
Erlang FTW!
Erlang FTW!Erlang FTW!
Erlang FTW!
 
Active Queue Management (for Cloud Services)
Active Queue Management (for Cloud Services)Active Queue Management (for Cloud Services)
Active Queue Management (for Cloud Services)
 
NoSQL learnings from the world of Telco
NoSQL learnings from the world of TelcoNoSQL learnings from the world of Telco
NoSQL learnings from the world of Telco
 
Emerging Trends in Communications
Emerging Trends in CommunicationsEmerging Trends in Communications
Emerging Trends in Communications
 
What I did on my Vacation (hint: Scuba & Erlang)
What I did on my Vacation (hint: Scuba & Erlang)What I did on my Vacation (hint: Scuba & Erlang)
What I did on my Vacation (hint: Scuba & Erlang)
 
Your business depends your customers - keeping them in the loop
Your business depends your customers - keeping them in the loop Your business depends your customers - keeping them in the loop
Your business depends your customers - keeping them in the loop
 
VoIP applications and the Cloud - Where gen_fsm really shines
VoIP applications and the Cloud - Where gen_fsm really shines VoIP applications and the Cloud - Where gen_fsm really shines
VoIP applications and the Cloud - Where gen_fsm really shines
 

Recently uploaded

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
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
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
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
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 

Finite State Machines - Why the fear?

Editor's Notes

  1. So, I started a phone company. It was a great thing. Phones make people happy, right?
  2. Yeah. Kids. Don’t do this at home. Don’t start a phone company.
  3. But I did. Hosted phone services for SMBs. Vonage for small businesses. In the cloud. Awesome
  4. 3 orders of magnitude
  5. 4 orders of magnitude
  6. Infinity!
  7. Houston – we have a problem
  8. Consider the simplest case of handling a call
  9. It actually gets a lot more complex
  10. And eventually, a *lot* more complex
  11. To put it differently,It was a “bet the farm” moment
  12. And it basically involved a lot of beer
  13. And we rewrote the whole damn thing in Erlang. WhyErlang? Well, Fault Tolerance, basicallyAnd oh, I’m not putting Kirk up there. That’s too obvious.
  14. The Six Essential Characteristics of a Fault Tolerant System
  15. The Six Essential Characteristics of a Fault Tolerant System
  16. The Six Essential Characteristics of a Fault Tolerant System
  17. The Six Essential Characteristics of a Fault Tolerant System
  18. The Six Essential Characteristics of a Fault Tolerant System
  19. The Six Essential Characteristics of a Fault Tolerant System
  20. ‘Distributed’ problems mean you spend a huge chunk of your time dealing with theadminstrivia of distribution.With erlang you get that for free!
  21. Ok, not really true. You still have to deal with ‘deep problems’ (hard core parallelization issues, etc.)But you’d have to deal with that anyhow!
  22. Implement the server part of a client/server relationship
  23. Talk to tcp over sockets
  24. Event handling
  25. Finite state machines
  26. And a bunch more (gen_udp, gen_utp!, etc.)
  27. But, we’re talking about Finite State Machines
  28. Lets talk about FSMs
  29. Putting this into practice, here is some code
  30. A system has states
  31. When certain events show up
  32. You do something
  33. And transition to the next state
  34. Wait, WHUT? Where did the “events” come from?
  35. I’m glad you asked  more code
  36. And thusly an event is sent
  37. Voila, an ErlangFSM
  38. 2.0 is anightmare; Stick w/ 1.0
  39. A system has states
  40. Events and transitions
  41. The code
  42. The states
  43. When you receive an event
  44. try to do something
  45. If it works go to the next state
  46. If it fails, go to a differen state
  47. Thusly
  48. And now for the events
  49. But wait! What if you walk out partway?
  50. So, a wee bit triclyhere -
  51. We have a timeout
  52. And it tells you where to go after the timeout
  53. And, you’re done.
  54. Lets look at this as a ‘real world” thingy
  55. But, you say, BUT, what about the complexity of dealing with FSMs? They’re big! And unweildy!
  56. Nah. They aren’t. Not in Erlang
  57. Remember this? It was a PITA? Actually, a small part of a PITA?
  58. But each one is tightly encapsulated, and clean.It’s the Erlang Way
  59. But each one is tightly encapsulated, and clean.It’s the Erlang Way
  60. My fanciful slides are actually real. This actually happens.
  61. And it’s the same for everything else I showed. FSMs of FSMs.
  62. An FSM of FSMs of FSMsBuilding these out “correctly”, in real time, is (was!) trivial
  63. “Real World”  Business Rules can help. (VM,syncrhonziation)