Duo Disco - doing the Erlang dance
Upcoming SlideShare
Loading in...5
×
 

Duo Disco - doing the Erlang dance

on

  • 237 views

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

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

Statistics

Views

Total Views
237
Views on SlideShare
204
Embed Views
33

Actions

Likes
0
Downloads
0
Comments
0

1 Embed 33

https://twitter.com 33

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Duo Disco - doing the Erlang dance Duo Disco - doing the Erlang dance Presentation Transcript

  • 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