Chris
Pine’s Learn To Program is a book that lives
up to the promise of the title. Aimed at the complete
programming novice, it guides the reader through the
perils, pitfalls and (with a bit of luck) pleasures of
programming.
The author’s choice of language is Ruby; this
may, at first sight, seem somewhat eccentric. After all,
Ruby is not exactly a ‘mainstream’ language
(yet?). To be blunt, there are far more C++ and Java
programmers in the world than there are Ruby programmers.
In fact, there is a good case for using Ruby as a language
for novice coders. To justify his choice, the author
compares a simple ‘Hello world’ written in
Java…
public class HelloWorld {
public
static void main(String []args) {
System.out.println(“Hello
world”);
}
}
…with its equivalent in Ruby:
puts 'Hello world'
The book starts out with a very gentle introduction
to programming. Chapters Two and Three show you how to
add numbers and displaying text on screen. It is only
in chapter Four that the concepts of variables and assignment
are introduced. For some readers the tempo may be a bit
too sedate for comfort. However, the pace does accelerate
a bit as the book progresses.
Over fifteen chapters, the reader is shown how to write
methods, iterate over the items in an array, create simple
class hierarchies, save and load files and even gets
to grips with Ruby’s blocks and Procs (‘nameless
functions’) which
are, in my view, pretty tricky to explain even to an
experienced programmer!
On the whole, Chris Pine’s book does a good job
of teaching a complete novice how to do some real programming.
You need to be aware of its limitations, however. While
it address concepts and constructs which are common to
most programming languages – such as variables,
parameters, functions/methods and recursion – it
deals only with the specifics of one language: Ruby.
It does not offer much guidance on how readers may apply
their newly-learned skills to more widely used languages
such as VB, C# or Java. Nor does it make any attempt
to grapple with the more difficult problems of Ruby such
as mixins, singleton methods, block precedence and scoping.
One other deficiency is that the book lacks an index.
True, it is only about 150 pages long so finding information
may not be too difficult. All the same, an index would
have been nice.
To help you decide whether it is likely to appeal to
you, I recommend that you browse through the first edition
of the book which the author has, very generously, made
freely available on his web site: http://pine.fm/LearnToProgram/.
The printed book is an expanded version of the online
tutorial.
You can buy
this book at a discount from Computer Manuals (UK).
Huw Collingbourne
May 2006 |