Foreword
From the yet to be written ``How Proust Can Make You a Better Programmer''
by Joe Armstrong, Creator of Erlang
“The Gmail editor cannot get typographic quotes right.”
“Disgraceful,” said Margery, “the sign of an illiterate programmer and
a decadent culture.”
“What should we do about it?”
“We must insist that the next programmer we hire has read all of ‘A la recherche du
temps perdu.’”
“All seven volumes?”
“All seven volumes.”
“Will it make them better at punctuation and make them get their quotes right?”
“Not necessarily, but it will make them a better programmer. It’s a
Zen thing….”
Learning to program is like learning to swim. No amount of theory is a
substitute for diving into the pool and flailing around in the water
gasping for air. The first time you sink under the water, you panic,
but when you bob to the surface and gulp in some air, you feel elated.
You think to yourself, “I can swim.” At least that’s how
I felt when I learned to swim.
It’s the same with programming. The first steps are the most difficult,
and you need a good teacher to encourage you to jump into the water.
Bruce Tate is such a teacher. This book gives you the opportunity to
start with what is the most difficult part of learning to program,
namely, getting started.
Let’s assume that you’ve actually managed the difficult task of
downloading and installing the interpreter or compiler for the
language you are interested in. What should you do next? What
will be your first program?
Bruce neatly answers this question. Just type in the programs and
program fragments in this book to see whether you can reproduce his
results. Don’t think about writing your own programs yet—just try
to reproduce the examples in the book. As you grow in confidence, you
will be able to tackle your own programming projects.
The first step in acquiring any new skill is not being able to do your
own thing but being able to reproduce what other people have done
before you. This is the quickest way to mastering a skill.
Getting started with programming in a new language is not so much a
deep exercise in understanding the underlying principles that a
language embodies; it is rather a matter of getting the semicolons and
commas in the right places and understanding the weird error messages
that the system spits out when you make an error. It is not until you
get beyond the messy business of entering a program and getting it
through the compiler that you can even start to think about the
meaning of the different language constructs.
Once you’ve gotten through the mechanics of entering and running programs,
you can sit back and relax. Your subconscious does the rest. While
your conscious brain is figuring out where to put the semicolons, your
subconscious is figuring out the deep meaning that lies underneath the
surface structures. Then you’ll wake up one day suddenly understanding
the deeper meaning of a logic program or why a particular language had
a particular construct.
Knowing a small amount about many languages is a useful skill. I often
find that I need to understand a bit of Python or Ruby to solve a
particular problem. The programs I download from the Internet are often
written in a variety of languages and need a little tweaking before I
can use them.
Each language has its own set of idioms, its strengths, and its
weaknesses. By learning several different programming languages, you
will be able to see which language is best suited to the kinds of
problems that interest you most.
I’m pleased to see that Bruce’s taste in programming languages is
eclectic. He covers not only the well-established languages such as
Ruby but also less-well-appreciated
languages like Io. Ultimately, programming is about understanding, and
understanding is about ideas. So, exposure to new ideas is essential to
a deeper understanding of what programming is all about.
A Zen master might tell you that to be better at mathematics you’d
better study Latin. Thus it is with programming. To better understand
the essence of OO programming, you should study logic or functional
programming (FP). To be better at FP, you should study Assembler.
Books on comparative programming languages were popular when I grew up
as a programmer, but most of these were academic tomes that gave
little practical guidance to how to actually go about using a
language. This reflected the technology of the age. You could read
about the ideas in a language, but actually trying it out was
virtually impossible.
Today, not only can we read about the ideas, but we can try them in
practice. This makes the difference between standing on the poolside
wondering whether it would be nice to swim and diving in and enjoying the
water.
I warmly recommend this book and hope that you enjoy reading it as
much as I have.
Joe Armstrong, creator of Erlang
Stockholm, 2 March 2010
Copyright © 2011, The Pragmatic Bookshelf.