OVERVIEW 19
At this stage you’ll be familiar with Erlang, so we’ll move on to more
interesti ng topics:
• You’ll pick up more advanced uses of t he shell. The shell can do a
lot more than we let on when you were first learni ng it. ( For exam-
ple, you can recall and edit previous expressions. This is covered
in Section 6.5, C
ommand Editing in the Erlang Shell, on page 130.)
• You’ll start learning the libraries (called modules in Erlang). Most
of the programs I write can be w ritten using five modules: lists, io,
file, dict, and gen_tcp; therefore, we’ll be using these modules a lot
throughout the book.
• As your programs get bigger, you’ll need to l earn how to automate
compiling and running them. The tool of choice for this is make.
We’ll see how to control the process by writing a makefile. This is
covered in Section 6.4, A
utomating Compilation with Makefiles, on
page
127.
•
The bigger world of Erlang programming uses an extensive library
collection called OTP.
1
As you gain experience with Erlang, you’ll
find that knowing OTP will save you lots of time. After all, why
reinvent the wheel if someone has already written the functional-
ity you need? We’ll learn the major OTP behaviors, in particular
gen_server. This is covered in Section
16.2, G
etting Started with
gen_server, on page
301.
• One of the main uses of Erlang is writ i ng distributed programs,
so now is the time to start experimenting. You can start with the
examples in Chapter
10, D
istributed Programming, on page 175,
and you can extend them in any way you want.
Stage 2.5: I May Learn Some Optional Stuff
You don’t have to read every chapter in this book the first time through.
Unlike most of the languages you have probably met before, Erlang is
a concurrent programming language—this makes it particularly suited
for writing distributed programs and for programming modern multi-
core and SMP
2
computers. Most Erlang programs will just run faster
when run on a multicore or SMP machine.
Erlang programming in volves using a programming paradigm that I call
concurrency-oriented programming (COP).
1. Open Telecom Platform.
2. Symmetric multiprocessing.
Report erratum
this copy is (P1.1 printing, July, 2007)
www.it-ebooks.info