Erlang-workshop
|
Erlang is a functional programming language that comes with a free (as in both senses) compiler and runtime environment from Ericsson, who use it in telecom equipment. The ecosystem is not aimed at number crunching, however it can outperform other solutions in terms of scalability and fault tolerance, which is useful for web services that have to survive traffic peaks and hardly tolerate downtime.
At Hackerspace Budapest, we use it
- in the bot on our IRC channel (we can reload code without disconnecting it from the IRC server),
- it serves the requests made to our HackSense system about whether the hackerspace is open or not, and
- as a TCP-to-serial bridge for a big LED display.
Preparation for the workshop[edit]
It's best to have Erlang/OTP installed on your box,
- most GNU/Linux distributions have it in their repositories, for example Debian and Ubuntu have an
erlang
metapackage that installs everything - Windows users can download binaries from the official site
- Mac OS X users can use the semi-official Erlang Solutions builds
- if none of the above worked for you, it can still be compiled from source, available from both links above
To verify the success of your installation,
- on Unix-like systems, enter
erl -version
in a terminal, and you should get something like this:Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 5.10.4
- on Windows, the installer creates an
Erlang OTP
entry in the Start menu, you can launch an Erlang shell from there – if it displays the Erlang version, you're good (you can close the window with the × in the corner).
About the workshop[edit]
The workshop will use the following as a guideline – any of the following items can be omitted if everyone already knows about it (or just noone cares), and we can go into the deep details if there's a need for that.
- installing erlang (hopefully everyone will complete this beforehand)
- using the interactive shell
- Erlang types
- Erlang modules
- solving problems with functional programming
- Erlang parallel programming: spawning processes and passing messages between them (scaling vertically)
- hot code loading
- running code on multiple nodes (scaling horizontally)
- using OTP (Open Telecom Platform) to take advantage of code the Ericsson engineers already wrote for us
- storing data (ETS, DETS, Mnesia)
- building web APIs with webmachine
Here's the code we wrote: https://gist.github.com/dnet/8568440
Further reading[edit]
If you'd like to learn about Erlang before and/or after the workshop, these are the resources I'd recommend:
- the official Erlang documentation (you can either download it from the links above or install it on Debian/Ubuntu systems as
erlang-doc
) - http://learnyousomeerlang.com/ (it's free to read it online)
- http://www.erlangprogramming.org/ (great book with an example project that gets extended/improved as the chapters describe a platform feature)
- Building Web Applications with Erlang (it introduces the narrow but interesting segment of web applications)
- Programming Erlang (2nd edition) (it's available in DRM-free format, the author is Joe Armstrong, one of the creators of Erlang, and the book also gives a sneak peak into the features of the next major release, R17)