4c70 Erlang - Telecomix Crypto Munitions Bureau

Erlang

From Telecomix Crypto Munitions Bureau

Jump to: navigation, search
Erlang is a nice programming language.

If haskell is elvish, then erlang is like robotish.

Erlang was originally invented at Ericsson for programming telephone switches. It is nowadays used to program any form of computer system that needs to be highly concurrent and reliable. Web servers, XMPP chat servers, high-freequency trading algorithms and telephone switches can all be programmed using Erlang.

Erlang has built in support for easily creating clusters of servers. Processes in one node can communicate with processes in other nodes using ordinary message passing. This is a key feature for building insanely reliable systems that can literary survive hellfires and earthquakes. This follows the erlang cybernetic theory: If a subsystem located at one node goes down, it will immediately be detected and another node will replace it before anyone notice. There is a backside to this: Erlang assumes that all nodes in the cluster is trusted (a stereotypic behavior for a megacorporation that hides its vital telephone switches in nuclear-proof bunkers) and because of that, there is absolutely no security at all between the nodes in the cluster. The cluster very much behaves like a single computer. If one node is compromised, all are compromised.

It is possible to "somewhat easily" define less privileged communication channels between nodes in order to maintain a cluster of untrusted nodes.

View the cult movie Erlang, the movie for a presentation of the language?

Contents

[edit] Short description of Erlang

  • Functional, strict evaluation (no infinite arrays)
  • Erlang rapes type theory - a function is allowed to return any value of any type.
  • Made for concurrency
    • Almost everything is a process!!
    • Processes does not share state -- (Theory: see synchronous vs. asynchronous)
    • Everything is sent as messages between processes
  • Standard library is OTP (Open Telecom Platform)
  • Erlang is built for { getting projects completed in time + concurrency + realiability }

[edit] Learn erlang from basics

Go and check Learn You Some Erlang For Great Good!!.

[edit] Coding

Everything in erlang is built up of modules, just like java programs is built from classes. Modules very often describes processes that can be run within the system. Essentially, you will spend your time building processes that sends lots and lots of messages to each others. (Read wikipedia about the Actor model if you wish.)

The Open Telecom Platform is a set of modules that comes with erlang. It is possible to write code that does not use OTP, but it is not recommended. OTP contains code for helping you more easily creating systems that can recover from failure, make clusters and also allows you to update code while it is running. This is probably the reason why you picked this programming language.

[edit] IDE?

  • erlang-mode for Emacs.
  • Erlide - Eclispe plugin. It is functioning well and has some advanced features like integrated debugger, content assist, semantic highlighting, navigation support and Wrangler integration.

[edit] behaviours

libraries

  • A module that contains a number of functions (that it exports), and nothing else. (Not a behaviour per se.)

worker patterns

  • gen_server - sends/receives messages and has a state
  • gen_fsm - finite state machines
  • gen_event - reacts on larger system events, like errors

control structure patterns

[edit] releases

  • coding bureaucracy!! - makes it simple to manage software updates and keep track of dependencies

[edit] Sources

Personal tools
0