Op-ed: Have you seen my monkey?
Originally appearing in October's JAX Magazine, Jessica Kerr believes you can become more than just a programming primate through abstraction.
Are you a code monkey? Of course not! You’re smarter!
How are you smarter? Working memory capacity makes one human smarter than another. The more you can hold in your head at once, the smarter you are. And the better programmer: the more pieces of the system you hold in your head, the more problems you solve superfast.
Except, humans have no more working memory than monkeys. We can hold three to four things in our brains, and they can hold three to four things in their brains. What makes us smarter? Hint: it’s the same thing that makes a good programmer smarter than a code monkey.
As a human, I start out holding three to four things in my brain. Then I find some pattern among these things, and group them, and they become one thing. They fit together in one working memory slot.
Take a phone number: “314 714 5555.” Ten digits is a lot to hold in my head. When I look at this number, I don’t see ten digits. I see my area code, my area code again except starting with 7, and all fives. The digits 3, 1, and 4 are three things, but “my area code” is one thing. Ten digits now take up about three spots in my head.
Humans do this. We create categories, find patterns, then larger patterns, and then patterns within the patterns. We think about rotors, then engines, and then airplanes. That monkey is still thinking about the rock right in front of him.
Neuroscientist Daniel Bor calls this “chunking." It gives humans our intellectual capacity. I call it “abstraction.” It makes coders into great developers.
Abstraction is seeing complicated parts as a coherent whole. It is conceiving a module as its interface. Abstraction is spotting patterns among chunks of code, making them one item in our head. It is zooming out from the irrelevant details in other parts of the system and zeroing in on the problem in front of us.
Abstraction is the key tool of our profession. The human programmer takes a nasty UML diagram, puts most of it out of their head, and closes in on the relevant piece for the current problem. Then they zoom back out and look at the system as a whole, disregarding the details of what they just finished. Great programmers go back and forth between syntax and the big picture.
Great programmers keep in mind the purpose of other parts of the system, but not internal details. If internal details aren’t in your head, your code won’t depend on them. Your system stays modular and clean.
Code monkeys don’t take the wider view. They don’t see the patterns. They don’t look at the big picture and ask “why are we doing it this way?“ They’re stuck in a jungle of local variables and for-loops.
Come down from the trees. Rise up the ladder of abstraction. Be human.
Author Bio: Jessica Kerr writes Scala code for Monsanto, technical presentations for conferences like CodeMash and DevTeach, articles for magazines like this one, and blog posts for her own pleasure. Find her work at http://blog.jessitron.com.
This article appeared in JAX Magazine Atmopshere. Download that and others here.
Image courtesy of frankh