When I was first learning Ruby, one of the resources that helped me most was Brian Marick’s “A Little Ruby, a Lot of Objects.” It’s modeled after The Little Schemer (or, if you’re older, The Little LISPer), but it uses Ruby, and teaches the core ideas of object-oriented programming in a way that helped me, even after I’d been doing OOP for 6 years. (I’m not surprised that his newer book, Functional Programming for the Object-Oriented Programmer, is just as illuminating.) The only thing I didn’t like was that it stopped after only 55 pages.
My team is about to welcome a new junior intern, and when Ben asked me for any learning resources I thought we should send, I suggested “A Little Ruby.” I have the original PDFs, but we were planning to send an email with URLs, and that’s when I realized that the book’s site, visibleworkings.com/little-ruby, was down.
I asked Brian whether I could host the files, and he agreed (thanks again!), so here they are:
A Little Ruby, A Lot of Objects
“My goal is to teach you a way to think about computation, to show you how far you can take a simple idea: that all computation consists of sending messages to objects.”
“The real reason for reading this book is that the ideas in it are neat.”
The First Message: Computation is sending messages to objects.
The Second Message: Message names describe the desired result, independently of the object that provides it.
The Third Message: Classes provide interface and hide representation.
Chapter 2: …We Get It From Others
The Fourth Message: Protocols group messages into coherent sets. If two different classes implement the same protocol, programs that depend only on that protocol can use them interchangeably.
The Fifth Message: Classes define protocols for their subclasses.
The Sixth Message: If a class and its superclass have methods with the same name, the class’s methods take precedence.
The Seventh Message: Instance variables are always found in self.
Chapter 3: Turtles All The Way Down
The Eighth Message: Classes are objects with a protocol to create other objects
The Ninth Message: Methods are found by searching through lists of objects.
The Tenth Message: In computation, simple rules combine to allow complex possibilities
The Eleventh Message: Everything inherits from Object.
You must be logged in to post a comment.