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 differe...
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. D...
DuoDisco Architecture 
● Table: player 
○ id 
○ name 
○ status (“waiting”, “playing”, “loading”, etc) 
○ connected (true /...
Disco architecture issues 
● Race Condition Paradise 
○ Connection drops 
○ Connection latency 
○ Subtle client difference...
So what about that Erlang thing? 
● A language, VM and runtime system 
● Fault tolerant 
● Concurrent 
● Functional 
● In ...
Erlang: Fault Tolerance 
● Systems will error 
● “Let it crash” 
○ Only program the happy path 
● You will be restarted 
○...
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/...
Erlang + Web = Zotonic 
● “The Django of Erlang” 
● Web development framework 
○ Built-in web server; CMS 
○ Opinionated &...
Back in the Disco… 
● 3 clients, iOS, Android & HTML 
● Backend: Erlang + Zotonic (obviously...) 
● JSON over WebSockets 
...
DuoDisco refactoring 
● Model it the Erlang way 
● Every player is a process 
● “Room” processes for connected players 
● ...
DuoDisco findings 
● First try-out at Extrapool Festival 2 wks ago 
● No more weird bugs! 
● Lessons learned 
○ Think (a b...
Links 
http://erlang.org/ - the Erlang language 
http://zotonic.com/ - The web framework 
http://duodisco.nl/ - Duo Disco ...
Thanks! Questions? 
Contact: 
● http://twitter.com/acscherp 
● http://miraclethings.nl/ 
● http://github.com/arjan 
● buy ...
Duo Disco - doing the Erlang dance
Duo Disco - doing the Erlang dance
Duo Disco - doing the Erlang dance
Duo Disco - doing the Erlang dance
Upcoming SlideShare
Loading in …5
×

Duo Disco - doing the Erlang dance

598
-1

Published on

Introducing Erlang and Zotonic through the use case of the Duo Disco app

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
598
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Duo Disco - doing the Erlang dance

  1. 1. Doing the Erlang dance A case study Arjan Scherpenisse @acscherp
  2. 2. Who am I? ● Wide range of interests ● Polyglot programmer ● Contributor to Open Source Software ● Doing things differently...
  3. 3. Where others use … , I use … ● Mac → Linux ● iOS → Android ● Textmate Sublime Text → Emacs ● … → Erlang!
  4. 4. Introducing:
  5. 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. 6. DuoDisco Architecture ● Table: player ○ id ○ name ○ status (“waiting”, “playing”, “loading”, etc) ○ connected (true / false) ○ connected_to (player id FK) ○ current_song_id
  7. 7. 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..
  8. 8. So what about that Erlang thing? ● A language, VM and runtime system ● Fault tolerant ● Concurrent ● Functional ● In use by major players
  9. 9. 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
  10. 10. Erlang: Concurrence ● Processes (“Actors”) are cheap ● Processes communicate ● Processes contain state
  11. 11. 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/
  12. 12. 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”
  13. 13. 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)
  14. 14. 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
  15. 15. 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
  16. 16. 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
  17. 17. Thanks! Questions? Contact: ● http://twitter.com/acscherp ● http://miraclethings.nl/ ● http://github.com/arjan ● buy me a beer :p
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×