Archives for the ‘Craftsmanship’ Category

The Secret to Software Craftsmanship

Perfect Practice creates Code Poetry

From Journeyman to Master

It’s been a while since I last coded, so I jumped at the opportunity when I heard about an Object-Oriented kata run by Sandro Mancuso, the man who started the London Software Craftsmanship Community. Sandro and I’ve exchanged a handful of contemplations about the Software Craftsmanship Manifesto recently, so I was really glad to experience it firsthand last week.

According to Sandro, the thing a craftsman strives to achieve is “Perfect Code”. If that’s at one end of the spectrum, what’s at the other? The code we write at work, our Daily Code. And what’s in-between? The space in-between, says Sandro, “represents how much we suck”. I laugh out loud. This remark warms my heart and tickles my funny bone. I like to think of it as “my room for improvement”. Either way, the gap exists and we can all do something about it. It turns out that something is called “Perfect Practice”.

What does “perfect” mean?

To me, “perfect” is an aspiration. It’s elusive by design. It’s an aspiration because we’re always to make things as great as they can be. It’s elusive because something can always be improved. The pursuit of perfection is striving to always be better. That makes “perfect” a moving target which is why it requires lifelong learning. It’s about being a lifelong apprentice.

Perfect Code requires Perfect Practice

When we’re at work, we’re faced with a whole bunch of challenges. Tight deadlines, peer pressure, insufficient skills, knowledge and/or experience, to name but a few. So what do we do? We make compromises, also known as hacks, false trade-offs, driven by short-term thinking.

Instead of trying to write perfect code during work hours from the outset, Sandro suggests we strive for Perfect Practice. In our own time, on our own terms. Why? Because this creates the headspace we need to learn how to do our job better. To close the gap, we need different conditions from those associated with pure “delivery mode”. The army calls it “Train hard, fight easy.” Software crafts people call it “Perfect Practice”.

“The longest journey begins with a single step…”

Sandro gets us to work in pairs, doing Test-Driven Development to develop a banking application with basic functionality such as making deposits and withdrawals. He repeatedly reminds us that the goal of the exercise is to learn and not, as we might immediately assume, to be the pair to finish first or complete it in its entirety.

“It doesn’t matter how far you get in the exercise,” Sandro says. “The goal is ‘Perfect Practice’. Over time, with practice, this becomes second nature. That’s what will enable us to write better code at work.”

Since it’s been a while since I last coded, I give my pair buddy Dan a brief description of my technical skills, knowledge and experience. I explain I was most definitely rusty at best and that I would strive to be better. As a sign of trust, he plugs in the second keyboard and mouse and we’re good to go.

The Art of Perfect Practice

The rest is “Perfect Practice”. Instead of rushing around like a pair of headless chickens, we took our time to think and talk things through, from the approach we would take (Domain-Driven Design) down to the specifics (Ubiquitous Language, Design Patterns and the careful naming of each variable and method).

The result? Well-crafted code that is easy to understand and maintain. Every decision was conscious and considered. What else? A sense of immense satisfaction. It tasted of euphoria because it brought back memories of all those times when we took care to do a good job. And the many possibilities for improvement. I could hear my heart sing.

Class Kata

And as I looked around the room, filled with 15 smiling faces and furrowed brows, all signs of minds deep in thought and conversation, I have proof. Proof that there are others out there who care about their craft. People who care so deeply that they invest their own time in Perfect Practice.

To think of many things

The kata reminded me of many things. That everything we produce tells us a lot about who we are. That programming is poetry, a transmutation of ideas into words. That it takes 10,000 hours to get really good at what we do. That Perfect Practice can be part of what we do and how we live. Every day.

How will you feed your need for Perfect Practice today?