The Pragmatic Bookshelf, 2007. – 297.
This is a hands-on book. Scripting is like riding a bicycle: you don’t learn it by reading about it; you learn it by doing it. And you get better by doing more of it. The purpose of a book, or of a coach, is to direct your practice so that you get better faster.
Therefore, the book is organized around four separate projects that are similar to those you might do in real life. I build the first two projects slowly, showing and explaining all my work. You’ll learn best if you type along with me, building the project as we go. In the third and fourth projects, I move faster and explain only the finished result.
The practice files that come with the book contain a series of snapshots for each of the first two projects. The snippets of Ruby code in the book identify the file they come from. You can look at the file to see the snippet in context, to diagnose problems by comparing what you’ve typed to what I have, or to start your own typing in the middle of a project instead of at the beginning.
Some of you won’t create the projects along with me. I do still urge you to work through the exercises and compare your solutions to the solutions I give.
An Outline of the Book
Part I, on page 30, teaches you the basics of Ruby and the basics of scripting. If you’ve never programmed, work through it carefully. If you already know a language, you can read it more casually, but do still read it. Ruby is based on ideas you might not know and has features you may not have seen before; if you skip them, you won’t be prepared for the rest of the book.
Part II, on page 67, adds more Ruby facts, but it’s mainly about teaching you how to write scripts in a steady, controlled way. All programmers know the feeling of hitting that wall where they can’t make any change without breaking something. I want to show you how to push that wall further away.
Part III, on page 139, concentrates on accomplishing more with less effort. It shows how to save work by finding, understanding, and including libraries written by others. It shows you how to set up your scripts so that your co-workers can download, install, and use them easily. While demonstrating still more features of Ruby, this part also elaborates on an important topic from Part II, regular expressions, a powerful way of searching text.
Part IV, on page 213, covers the advanced topic of inheritance. Inheritance can sometimes save even more work than libraries because someone else designs a framework for part of your script. You need only plug in pieces that the framework orchestrates. Part IV shows you both how to use complicated frameworks others create and how to make simpler ones for yourself. You may want to get experience writing scripts of your own before learning about frameworks.