SBPP #1: Introduction

The Ruby Rogues are reading Smalltalk Best Practice Patterns for next month’s book club, so I finally got around to ordering a copy. It’s high time, considering that in my experience it’s one of the most consistently recommended programming books in print.

Some notes and quotes from the introduction:

  • Defining patterns: “a pattern is a decision an expert makes over and over”.
  • Patterns in the small: “I’m constantly amazed at how even a little help cleaning up small problems reveals the source and solution of much bigger problems”.
  • “It is easy to get numbed to pain and frustration, or treat it as if is part of the territory”—this dovetails with a realization I had recently: my “Confident Code” talk, at its core, isn’t about clean code; it’s about joy. Programming in a conducive programming language should be pleasant. Fun. Joyful, even. Antipatterns steal joy because they add weight to every step. It’s worthwhile to periodically remember the joy of that first “a-ha!” moment in Ruby (or Smalltalk, or whatever), and figure out if and why we aren’t feeling that way anymore.
  • “The very act of deciding what corners to cut slows down development. Using these patterns lets you program flat out, applying patterns as fast as your fingers will go, and get results as quickly as possible”. Beck goes on to say of adopting these patterns “whole hog”: “…I spent a couple of frustrating weeks programming at less than full speed. After that, I memorized enough patterns to get back up to my old productivity, but the code I was producing was cleaner than before. After a couple more weeks, I no longer had to look up any patterns, and my productivity shot up while my code kept getting cleaner and cleaner.”

This last quote nicely sums up an observation I’ve made over the years. A lot of programmers, when evaluating a new discipline, note (correctly) that adopting it will slow them down in the short term. They then extrapolate from this short-term slowdown that it will always slow them down, and is therefore a waste of time.

Maybe it’s just good ‘ole hacker hubris: the assumption that we can fully assimilate any new knowledge in a matter of hours, and if not, it’s not worth learning. In any case, it’s a flawed mental model. New disciplines, when practiced diligently, eventually become automatic.