summaryrefslogtreecommitdiff
path: root/2012/osmo_erlang-osdc2012/section-erlang.tex
blob: 1af42e2281e3df977baf7f884a5c78a05689db92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
\section{Erlang in Osmocom}

\begin{frame}{Introducing Erlang}
Erlang/OTP
\begin{itemize}
	\item is a functional, non-OO programming language
	\item promotes some principles that make it easier to write secure code
	\item was crreated by Ericsson for Telecom signalling applications
	\item has excellent built-in ASN.1 compiler + runtime support
	\item has {\tt gen\_fsm} support for well-defined finit state machines
\end{itemize}
\end{frame}

\begin{frame}{Safe and secure programming}
Erlang enables and encourages to
\begin{itemize}
	\item avoid defensive programming, rather fail-fast and raise exceptions
	\item avoid having global/shared state as everything is pass-by-value, not reference
	\item avoid accidential/improper reuse of variables by single assignment
	\item not have to worry about memory allocation problems like
		buffer overflows / double-free
\end{itemize}
\end{frame}

\begin{frame}{Erlang headaches}
If you're used to C/C++ or even Java, Erlang will give you headaches,
too.
\begin{itemize}
	\item you have no interative loops like for/while, but always
		have to use (tail) recursion
	\item you have to type a lot when accessing members of records
		(structures), as you need to specify the type name on
		every access
	\item avoiding global state may be useful, but very hard at
		times
\end{itemize}
\end{frame}

\begin{frame}{Reasons to use Erlang in Osmocom}
\begin{itemize}
	\item best ASN.1 support found as Free Software for any
		programming language
	\begin{itemize}
		\item TCAP/MAP use ASN.1 Information Object Classes,
			which e.g. asn1c doesn't support
		\item supports PER aligned and unaligned, required in
			RANAP/RRC for UMTS.
		\item very strict validation of input data, including
			range checks of integer values against
			constraings in ASN.1, etc.
	\end{itemize}
	\item built-in support for finite state machines
	\item Erlang {\em many processes and message passing} model 1:1
		match to ITU TCAP specification.
\end{itemize}
\end{frame}

\begin{frame}{Erlang in Osmocom projets}
\begin{itemize}
	\item all current Osmocom developers are C (possibly C++) developers
	\item nobody really likes to use some bloatet inefficient and
		unknown programming language (compared to C...)
	\item almost every other sub-project of Osmocom is implemented
		in pure C
	\item apart from my projects described here, Erlang hasn't
		really picked up with other developers
	\item Erlang wasn't chosen because we love it, but because it
		makes techical sense in some specific applications,
		compared to alternavies requiring to buy/user
		porprietary ASN.1 tools or write our own
\end{itemize}
\end{frame}
personal git repositories of Harald Welte. Your mileage may vary