SlideShare a Scribd company logo
1 of 21
Download to read offline
Doing the Erlang dance 
A case study 
Arjan Scherpenisse 
@acscherp
Who am I? 
● Wide range of interests 
● Polyglot programmer 
● Contributor to Open Source Software 
● Doing things differently...
Where others use … , I use … 
● Mac → Linux 
● iOS → Android 
● Textmate Sublime Text → Emacs 
● … → Erlang!
Introducing:
Do the DuoDisco! 
● Mark Meeuwenoord, Klasien van de Zandschulp, 
James Bryan Graves 
● It’s fun. Profit comes later 
1. Download app 
2. Join disco 
3. Dance 
4. Find partner → score! 
5. goto 3
DuoDisco Architecture 
● Table: player 
○ id 
○ name 
○ status (“waiting”, “playing”, “loading”, etc) 
○ connected (true / false) 
○ connected_to (player id FK) 
○ current_song_id
Disco architecture issues 
● Race Condition Paradise 
○ Connection drops 
○ Connection latency 
○ Subtle client differences 
● These bugs never happen while you’re 
developing 
● Player A → Player B, Player B → Player C 
○ Debugging nightmare..
So what about that Erlang thing? 
● A language, VM and runtime system 
● Fault tolerant 
● Concurrent 
● Functional 
● In use by major players
Erlang: Fault Tolerance 
● Systems will error 
● “Let it crash” 
○ Only program the happy path 
● You will be restarted 
○ by your supervisor 
○ with a clean slate
Erlang: Concurrence 
● Processes (“Actors”) are cheap 
● Processes communicate 
● Processes contain state
Erlang: It’s Functional 
● Assign-once 
● Pattern matching 
● No loops 
○ use (tail)recursion 
○ list comprehensions, map/reduce 
● It has a WEIRD SYNTAX? ?F()(*$#)(*# 
○ I had to say it somewhere 
○ Look at Elixir, it rocks. http://elixir-lang.org/
Erlang + Web = Zotonic 
● “The Django of Erlang” 
● Web development framework 
○ Built-in web server; CMS 
○ Opinionated & extensible 
● Great performance out-of-the-box 
● Easy to use data model 
○ Semantic web “everything is a thing”
Back in the Disco… 
● 3 clients, iOS, Android & HTML 
● Backend: Erlang + Zotonic (obviously...) 
● JSON over WebSockets 
● REST for login / discovery 
● Zotonic manages data model 
○ (media files, multiple disco’s)
DuoDisco refactoring 
● Model it the Erlang way 
● Every player is a process 
● “Room” processes for connected players 
● One match-making process 
○ Uses process registry for querying processes
DuoDisco findings 
● First try-out at Extrapool Festival 2 wks ago 
● No more weird bugs! 
● Lessons learned 
○ Think (a bit) before you code 
○ Use the right tool for the job 
○ Dare to iterate and start over
Links 
http://erlang.org/ - the Erlang language 
http://zotonic.com/ - The web framework 
http://duodisco.nl/ - Duo Disco app info 
http://elixir-lang.org/ - Erlang with different syntax
Thanks! Questions? 
Contact: 
● http://twitter.com/acscherp 
● http://miraclethings.nl/ 
● http://github.com/arjan 
● buy me a beer :p

More Related Content

Viewers also liked

The State Of Israel And The Muslim World 22166
The State Of Israel And The Muslim World 22166The State Of Israel And The Muslim World 22166
The State Of Israel And The Muslim World 22166GZ-Israel
 
Ezvc
EzvcEzvc
Ezvcezvc
 
Israel 1214781329718633 9
Israel 1214781329718633 9Israel 1214781329718633 9
Israel 1214781329718633 9GZ-Israel
 
Mediamatic Night Lab #2
Mediamatic Night Lab #2Mediamatic Night Lab #2
Mediamatic Night Lab #2Arjan
 
O Meu Pequeno Pais
O Meu Pequeno PaisO Meu Pequeno Pais
O Meu Pequeno PaisGZ-Israel
 
Israelair Photos 1214209899278185 8
Israelair Photos 1214209899278185 8Israelair Photos 1214209899278185 8
Israelair Photos 1214209899278185 8GZ-Israel
 
Hello, world
Hello, worldHello, world
Hello, worldArjan
 
O mar desde esa banda. De Carlos Penela
O mar desde esa banda. De Carlos PenelaO mar desde esa banda. De Carlos Penela
O mar desde esa banda. De Carlos PenelaGZ-Israel
 
Arava Sites By Guy
Arava Sites By GuyArava Sites By Guy
Arava Sites By GuyGZ-Israel
 
Tel Aviv 1920 1940
Tel Aviv 1920 1940Tel Aviv 1920 1940
Tel Aviv 1920 1940GZ-Israel
 
Android workshop
Android workshopAndroid workshop
Android workshopArjan
 
Tweets polls surveys
Tweets polls surveysTweets polls surveys
Tweets polls surveysSandra Hines
 
Alice Quick Guide
Alice Quick GuideAlice Quick Guide
Alice Quick GuideKJSROSE
 
Zotonic presentation Erlang Camp Boston, august 2011
Zotonic presentation Erlang Camp Boston, august 2011Zotonic presentation Erlang Camp Boston, august 2011
Zotonic presentation Erlang Camp Boston, august 2011Arjan
 
Making it fast: Zotonic & Performance
Making it fast: Zotonic & PerformanceMaking it fast: Zotonic & Performance
Making it fast: Zotonic & PerformanceArjan
 

Viewers also liked (20)

The State Of Israel And The Muslim World 22166
The State Of Israel And The Muslim World 22166The State Of Israel And The Muslim World 22166
The State Of Israel And The Muslim World 22166
 
Ezvc
EzvcEzvc
Ezvc
 
Rami Meiri
Rami MeiriRami Meiri
Rami Meiri
 
Israel 1214781329718633 9
Israel 1214781329718633 9Israel 1214781329718633 9
Israel 1214781329718633 9
 
Road
RoadRoad
Road
 
Mediamatic Night Lab #2
Mediamatic Night Lab #2Mediamatic Night Lab #2
Mediamatic Night Lab #2
 
O Meu Pequeno Pais
O Meu Pequeno PaisO Meu Pequeno Pais
O Meu Pequeno Pais
 
Israelair Photos 1214209899278185 8
Israelair Photos 1214209899278185 8Israelair Photos 1214209899278185 8
Israelair Photos 1214209899278185 8
 
Hello, world
Hello, worldHello, world
Hello, world
 
O mar desde esa banda. De Carlos Penela
O mar desde esa banda. De Carlos PenelaO mar desde esa banda. De Carlos Penela
O mar desde esa banda. De Carlos Penela
 
IPsec
IPsecIPsec
IPsec
 
Arava Sites By Guy
Arava Sites By GuyArava Sites By Guy
Arava Sites By Guy
 
Tel Aviv 1920 1940
Tel Aviv 1920 1940Tel Aviv 1920 1940
Tel Aviv 1920 1940
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Tweets polls surveys
Tweets polls surveysTweets polls surveys
Tweets polls surveys
 
Maketechwork4u
Maketechwork4uMaketechwork4u
Maketechwork4u
 
Alice Quick Guide
Alice Quick GuideAlice Quick Guide
Alice Quick Guide
 
Zotonic presentation Erlang Camp Boston, august 2011
Zotonic presentation Erlang Camp Boston, august 2011Zotonic presentation Erlang Camp Boston, august 2011
Zotonic presentation Erlang Camp Boston, august 2011
 
Mother
MotherMother
Mother
 
Making it fast: Zotonic & Performance
Making it fast: Zotonic & PerformanceMaking it fast: Zotonic & Performance
Making it fast: Zotonic & Performance
 

Similar to Duo Disco - doing the Erlang dance

Webbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript DevelopersWebbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript DevelopersJuho Teperi
 
WebAssembly: In a Nutshell
WebAssembly: In a NutshellWebAssembly: In a Nutshell
WebAssembly: In a NutshellRangHo Lee
 
HelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersHelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersJuho Teperi
 
Castle Game Engine and the joy of making and using a custom game engine
Castle Game Engine and the joy  of making and using a custom game engineCastle Game Engine and the joy  of making and using a custom game engine
Castle Game Engine and the joy of making and using a custom game engineMichalis Kamburelis
 
Bsdtw17: george neville neil: realities of dtrace on free-bsd
Bsdtw17: george neville neil: realities of dtrace on free-bsdBsdtw17: george neville neil: realities of dtrace on free-bsd
Bsdtw17: george neville neil: realities of dtrace on free-bsdScott Tsai
 
Functional Programming With Elixir
Functional Programming With ElixirFunctional Programming With Elixir
Functional Programming With ElixirFramgia Vietnam
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015Jorg Janke
 
Linux as a gaming platform, ideology aside
Linux as a gaming platform, ideology asideLinux as a gaming platform, ideology aside
Linux as a gaming platform, ideology asideLeszek Godlewski
 
The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional ProgrammerDave Cross
 
Dfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshopDfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshopTamas K Lengyel
 
Don't Give Credit: Hacking Arcade Machines
Don't Give Credit: Hacking Arcade MachinesDon't Give Credit: Hacking Arcade Machines
Don't Give Credit: Hacking Arcade MachinesMichael Scovetta
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)Ary Borenszweig
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)Ary Borenszweig
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)Crystal Language
 
Schizophrenic files v2
Schizophrenic files v2Schizophrenic files v2
Schizophrenic files v2Ange Albertini
 

Similar to Duo Disco - doing the Erlang dance (20)

Webbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript DevelopersWebbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript Developers
 
WebAssembly: In a Nutshell
WebAssembly: In a NutshellWebAssembly: In a Nutshell
WebAssembly: In a Nutshell
 
Static analysis for beginners
Static analysis for beginnersStatic analysis for beginners
Static analysis for beginners
 
HelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersHelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript Developers
 
Castle Game Engine and the joy of making and using a custom game engine
Castle Game Engine and the joy  of making and using a custom game engineCastle Game Engine and the joy  of making and using a custom game engine
Castle Game Engine and the joy of making and using a custom game engine
 
Bsdtw17: george neville neil: realities of dtrace on free-bsd
Bsdtw17: george neville neil: realities of dtrace on free-bsdBsdtw17: george neville neil: realities of dtrace on free-bsd
Bsdtw17: george neville neil: realities of dtrace on free-bsd
 
Functional Programming With Elixir
Functional Programming With ElixirFunctional Programming With Elixir
Functional Programming With Elixir
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015
 
Linux as a gaming platform, ideology aside
Linux as a gaming platform, ideology asideLinux as a gaming platform, ideology aside
Linux as a gaming platform, ideology aside
 
Ruxmon.2013-08.-.CodeBro!
Ruxmon.2013-08.-.CodeBro!Ruxmon.2013-08.-.CodeBro!
Ruxmon.2013-08.-.CodeBro!
 
Introdução à Elixir
Introdução à ElixirIntrodução à Elixir
Introdução à Elixir
 
erlang 101
erlang 101erlang 101
erlang 101
 
The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional Programmer
 
Dfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshopDfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshop
 
Don't Give Credit: Hacking Arcade Machines
Don't Give Credit: Hacking Arcade MachinesDon't Give Credit: Hacking Arcade Machines
Don't Give Credit: Hacking Arcade Machines
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
 
Cloud accounting software uk
Cloud accounting software ukCloud accounting software uk
Cloud accounting software uk
 
Schizophrenic files v2
Schizophrenic files v2Schizophrenic files v2
Schizophrenic files v2
 

More from Arjan

De Naakte Noorderlingen
De Naakte NoorderlingenDe Naakte Noorderlingen
De Naakte NoorderlingenArjan
 
Zotonic tutorial EUC 2013
Zotonic tutorial EUC 2013Zotonic tutorial EUC 2013
Zotonic tutorial EUC 2013Arjan
 
Erlang: Software for a Concurrent world
Erlang: Software for a Concurrent worldErlang: Software for a Concurrent world
Erlang: Software for a Concurrent worldArjan
 
Physical Computing with Android and IOIO
Physical Computing with Android and IOIOPhysical Computing with Android and IOIO
Physical Computing with Android and IOIOArjan
 
Open-CI for beginners
Open-CI for beginnersOpen-CI for beginners
Open-CI for beginnersArjan
 
OBG Presentatie Mediamatic Salon
OBG Presentatie Mediamatic SalonOBG Presentatie Mediamatic Salon
OBG Presentatie Mediamatic SalonArjan
 

More from Arjan (6)

De Naakte Noorderlingen
De Naakte NoorderlingenDe Naakte Noorderlingen
De Naakte Noorderlingen
 
Zotonic tutorial EUC 2013
Zotonic tutorial EUC 2013Zotonic tutorial EUC 2013
Zotonic tutorial EUC 2013
 
Erlang: Software for a Concurrent world
Erlang: Software for a Concurrent worldErlang: Software for a Concurrent world
Erlang: Software for a Concurrent world
 
Physical Computing with Android and IOIO
Physical Computing with Android and IOIOPhysical Computing with Android and IOIO
Physical Computing with Android and IOIO
 
Open-CI for beginners
Open-CI for beginnersOpen-CI for beginners
Open-CI for beginners
 
OBG Presentatie Mediamatic Salon
OBG Presentatie Mediamatic SalonOBG Presentatie Mediamatic Salon
OBG Presentatie Mediamatic Salon
 

Recently uploaded

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

Duo Disco - doing the Erlang dance

  • 1. Doing the Erlang dance A case study Arjan Scherpenisse @acscherp
  • 2. Who am I? ● Wide range of interests ● Polyglot programmer ● Contributor to Open Source Software ● Doing things differently...
  • 3. Where others use … , I use … ● Mac → Linux ● iOS → Android ● Textmate Sublime Text → Emacs ● … → Erlang!
  • 5. Do the DuoDisco! ● Mark Meeuwenoord, Klasien van de Zandschulp, James Bryan Graves ● It’s fun. Profit comes later 1. Download app 2. Join disco 3. Dance 4. Find partner → score! 5. goto 3
  • 6. DuoDisco Architecture ● Table: player ○ id ○ name ○ status (“waiting”, “playing”, “loading”, etc) ○ connected (true / false) ○ connected_to (player id FK) ○ current_song_id
  • 7.
  • 8. Disco architecture issues ● Race Condition Paradise ○ Connection drops ○ Connection latency ○ Subtle client differences ● These bugs never happen while you’re developing ● Player A → Player B, Player B → Player C ○ Debugging nightmare..
  • 9.
  • 10. So what about that Erlang thing? ● A language, VM and runtime system ● Fault tolerant ● Concurrent ● Functional ● In use by major players
  • 11. Erlang: Fault Tolerance ● Systems will error ● “Let it crash” ○ Only program the happy path ● You will be restarted ○ by your supervisor ○ with a clean slate
  • 12. Erlang: Concurrence ● Processes (“Actors”) are cheap ● Processes communicate ● Processes contain state
  • 13. Erlang: It’s Functional ● Assign-once ● Pattern matching ● No loops ○ use (tail)recursion ○ list comprehensions, map/reduce ● It has a WEIRD SYNTAX? ?F()(*$#)(*# ○ I had to say it somewhere ○ Look at Elixir, it rocks. http://elixir-lang.org/
  • 14. Erlang + Web = Zotonic ● “The Django of Erlang” ● Web development framework ○ Built-in web server; CMS ○ Opinionated & extensible ● Great performance out-of-the-box ● Easy to use data model ○ Semantic web “everything is a thing”
  • 15. Back in the Disco… ● 3 clients, iOS, Android & HTML ● Backend: Erlang + Zotonic (obviously...) ● JSON over WebSockets ● REST for login / discovery ● Zotonic manages data model ○ (media files, multiple disco’s)
  • 16. DuoDisco refactoring ● Model it the Erlang way ● Every player is a process ● “Room” processes for connected players ● One match-making process ○ Uses process registry for querying processes
  • 17.
  • 18.
  • 19. DuoDisco findings ● First try-out at Extrapool Festival 2 wks ago ● No more weird bugs! ● Lessons learned ○ Think (a bit) before you code ○ Use the right tool for the job ○ Dare to iterate and start over
  • 20. Links http://erlang.org/ - the Erlang language http://zotonic.com/ - The web framework http://duodisco.nl/ - Duo Disco app info http://elixir-lang.org/ - Erlang with different syntax
  • 21. Thanks! Questions? Contact: ● http://twitter.com/acscherp ● http://miraclethings.nl/ ● http://github.com/arjan ● buy me a beer :p