Learn to Program, The Pragmatic Programmers: Ruby By: Chris Pine
This post is a part of blog series on my 2015 tech, anthro, and business reading list
“In any communication with humans, you can leave out all sorts of steps or concepts and let them fill in the gaps. In fact, you have to do this! We’d never be able to get anything done otherwise. The typical example is making a peanut butter and jelly sandwich. Normally, if you wanted someone to make you a peanut butter and jelly sandwich, you might simply say, “Hey, could you make me a peanut butter and jelly sandwich?” But if you were talking to someone who had never done it before, you would have to tell them how:
- Get out two slices of bread (and put the rest back).
- Get out the peanut butter, the jelly, and a butter knife.
- Spread the peanut butter on one slice of bread and the jelly on the other one.
- Put the peanut butter and jelly away, and take care of the knife.
- Put the slices together, put the sandwich on a plate, and bring it
to me. Thanks!
I imagine those would be sufficient instructions for a small child. Small children are needlessly, recklessly clever, though. What would you have to say to a computer? Well, let’s just look at that first step:
1….
But no, this isn’t nearly good enough. For starters, how does it “locate bread”? We’ll have to set up some sort of database associating items with locations. The database will also need locations for peanut butter, jelly, knife, sink, plate, counter….
Oh, and what if the bread is in a bread box? You’ll need to open it first. Or in a cabinet? Or in your fridge? Perhaps behind something else? Or what if it is already on the counter?? You didn’t think of that one, did you? So now we have this:
• Initialize item-to-location database.
• If bread is in bread box:
– Open bread box.
– Pick up bread.
– Remove hands from bread box. – Close bread box.
a) Locate bread.
b) Pick up bread.
c) Move to empty counter.
d) Set down bread on counter. e) Open bag of bread.”
–Chris Pine, Learn to Program, introduction
He goes on to break down even further to what you would have to really tell a computer in order to make a peanut butter sandwich. And it gets pretty complicated.
Ironically, its that first sentence that actually made me want to study how people think, and how we communicate. Its why I became a social scientist. Because essentially, its amazing that we can get so much stuff done without explaining it barely at all. And now I am on the reverse of that coin. As a web developer, I have to be extremely specific, and describe each detail. Or else nothing is getting done.
One thing that is so clever about this book is its use of plain language (as demonstrated above). It teaches you about Ruby programming in the same ways that you may learn about any language. There are simple comparisons to plain english that are super helpful in understanding what it is that you are learning (such as: if you think of data types such as strings and floats are like nouns, then methods are like verbs because they actually do something).
A great read for a budding developer!
If you are interested in this book, check it out: