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?

4 Responses to “The Secret to Software Craftsmanship”

  1. Freek writes:

    great piece Portia!
    ‘I could hear my heart sing’ – this resonated with me. I’ve experienced similar events and I have marvelled at the energy and drive of people determined to improve themselves. It’s a shame that finding that same passion and dedication in the workplace is usually a lot harder…
    ‘Perfect code’ though? Somehow I get the feeling that the use of these terms do the craftmanship movement more harm then good. Code is resistant to perfect.
    I think that in Lean thinking people have stepped away from using the term perfection and instead are talking about improvement. Personally, I try to make code less sucky. Most days at least,and also through practice. Never perfect, but at least trying to improve :)

  2. portiatung writes:

    Hi Freek,

    Thanks for reading and commenting!

    Based on my understanding of Perfect Code, it’s an aspiration. It’s driven by Continuous Improvement, learning through trial and error. I’ve added a new section to clarify what “Perfect” in “Perfect Code” means to me: http://www.selfishprogramming.com/2008/09/22/waiting-for-godot/

    Thank you for helping to make the blog entry better!

  3. Richard writes:

    If you don’t aim for a target, your chances of hitting it (or even getting close) diminish. By aiming for perfection, your chances of having a *good* implementation that will survive change (both in terms of requirements and in team composition) improves.

  4. portiatung writes:

    Good to read you, Richard! “Perfect Practice” has helped me focus on why I’m doing what I’m doing the best I can.

Leave a Reply