WARNING

This is a draft

Erlang is a marvelous programming language, with a really professional community. Unfortunately, many Erlang projects don't have enough documentation. In the worst case, like in a long list of Open Source project, no documentation at all. That means a large bunch of features are not even known by the users. Well. In any case, we need something to find our way to find new functionnalities. Like a modern archeologist, I will try to give you some hints based on a real world example.

I am actually working on a really nice project based on XMPP (opens new window) or Extensible Messaging and Presence Protocol. This is the first time I am playing around this standard and never ever wrote any client or server in it. I barely know that it uses XML (opens new window) as main component. In the past, I used to install eJabberd (opens new window) or Prosody (opens new window) for some internal communication tool. The first one was written in Erlang and the second one was made in Lua. Both are pretty popular and stable, used in various open-source and private project.

# How XMPP works?

XMPP was designed twenty years ago, and was standardized the first time in 2004. This standard defines the different protocol used in XMPP and the philosophy around it.

# Playing with libraries

ProcessOne (opens new window), the company who create eJabberd, designed a full open-source library in Erlang called xmpp (opens new window). Unfortunatelly, this library does not document important parts, like, how to create a stream or a client connection. These parts of the library are present, but, you don't have any hints on how to use it. You will need to dig into the code and try to find how these things work together.

# Read the (available) documentation

# Read the code

Now it's the time to take a look into the code. This stage is really important, and, like any important, a developper does not really know where to start. In a classical application, the program entry-point, generally called main, is usually a good starting point. In case of a library, it's a bit more complicated. It's a bit like a puzzle or spaghetties.

The main goal is to reverse engineering an open-source projet, it's like reversing a production application, compiled in some weird language with a lot of obfuscation. So, our goal is to create something which uses XMPP, and the best way to create our entry-point is to take a module instead of a function.

src/xmpp_socket seems to be a good one. When we create a server or a client, we need to create a socket, and this socket will receive and send all the packet coming from our application.

# Create function specification

# Create function and module documentation

# Create test case

# Design a client

# Resources