Learn to Program by Chris Pine is a concise introduction to the world of programming using an interpreted scripting language called Ruby. An initial “cool point” goes to Pine for writing Learn to Program around Ruby, which is totally free to use, copy, modify, and distribute. The examples start from the basics of getting Ruby correctly installed and configured for your particular operating system. Although Ruby is mostly used to develop applications on Linux, it is a cross-platform language that is supported on many types of UNIX, DOS, Windows 95/98/Me/NT/2000/XP, MacOS, BeOS, and OS/2. I ran the examples on my Windows XP laptop without any problems, using a simple, free text editor called Textpad for some of the examples and the command line to round out my experience. The best part of it all: all of the programming tools were free! Gotta love it.
Pine aptly starts out with the essentials for most newbies to programming: data types, arithmetic operations, variables, and variable assignments. I found the overall approach and programming examples to be fun, detailed, and loaded with little tidbits of information, which gave great insight into the “how” and “why” of things. Pine’s examples and explanations throughout Learn to Program were great at illustrating the power of Ruby and programming in general, without having the overtly silly and annoying tone typically found in the Dummies series of books.
Learn to Program progressively and painlessly takes the reader through increasingly complex (for most newbies) programming concepts such as methods, classes, objects, recursion, and flow control. To reinforce the concepts in each chapter there are sections called “A Few Things to Try”, which were both interesting and amusing. One of the more interesting topics involved writing simple programs to read, write, save, and load files using YAML. (YAML is a format for representing objects as strings).
It’s always fun to learn how to dig around in various files to extract and manipulate information. This should also come in handy when managing log files on several OpenVMS servers I manage. Yes, there is a tested version of Ruby (version X1.8-1X014) for OpenVMS Alpha V7.3-1 and V7.3-2! The final chapter of Learn to Program tied all of the concepts together and introduced the use of blocks and procs as a step beyond using custom methods. The proc examples were an eloquent introduction into the more conceptually challenging topic of passing objects into methods and returning objects from methods. I remember learning the power of passing objects to and from methods in a college Java course (years ago), only after we were taken through the paces of writing programs the “dumb” way without knowing how to do this. I wish I had read this book before I took that class.