The Clean Coder

I just finished reading The Clean Coder: A Code of Conduct for Professional Programmers by Robert C. Martin.

Martin, affectionately known as “Uncle Bob” to many software professionals, is a well-known advocate of Agile development practices and software craftsmanship. A little more than a year ago my colleague Erik Rydeman recommended Martin’s Clean Code, and that book had a significant impact on my work.

Clean Coder (2011) is Martin’s most recent book. It’s a slim volume of lessons from his career, written so that others can learn from his mistakes. The book focuses less on code and more on the behavior of those who write it. I found this book less transformative then Clean Code, but it’s the best survey I’ve read of the real challenges faced by programmers at work, and I wish it had existed in 2009 so I could have read it as I finished my undergraduate degree. Here are my key takeaways today:

Commitment
It should be no surprise that four whole chapters are dedicated to making and keeping commitments: “Saying No,” “Saying Yes,” “Estimation,” and “Pressure” all deal with the challenge of telling management what you can and can’t do, and sticking to it. I liked one part in particular: Martin demonstrates that a clear language of commitment (I will do something by this time) and eliminating language that eschews responsibility will prevent many commitment problems. When you unequivocally take responsibility, you are less likely to overcommit – it makes you look bad! This may seem like obvious, generic advice for any discipline, but it’s necessary in software when we are often so bad at estimation, and often so pressured to throw our estimates.

Flow
I was surprised by a small tirade against the flow state many coders experience while working. Martin takes just a page to say that flow is harmful – that it trades in rational thought for a sense of speed and focus, and furthermore that flow makes a person irritable when interrupted and slow to resume their work.

I had a positive attitude toward flow until Martin pointed something out that changed my perspective: Pair programming blocks flow, because it encourages constant communication. The last few months at work are the first time I’ve spent the majority of my time pairing, and I haven’t missed the flow experience at all. Instead, I have written better code at a steady pace and been less bothered by interruptions than ever. For a team, anything that breaks down communication is a problem. I’ve changed my perspective on flow (and maybe on headphones) because of this observation.

Acceptance Testing
The one discipline discussed that I still have not used is acceptance testing. It’s tempting to write this chapter off, especially since Martin promotes his own tool, Fitnesse. But I’ve had positive experiences with the other disciplines in the book, so I’m anxious to give this a try. I’m not sure how useful a solo trial would be though – I may need to wait until I can convince a small team to give this a shot before I can evaluate its usefulness.

At the end of the book, Martin describes a simple system of software apprenticeship where engineers can be identified as masters, journeymen, and apprentices. At this point in my career, I seem to fit squarely into the journeyman category – five years of full-time employment writing software (skipping some non-programming schooling in the middle), experience on four shipped products all using different technologies, and becoming familiar with key disciplines. This book brought the inexperience of my past into painful focus (many thanks to the employers and colleagues that have pulled me through my apprenticeship years!). But it also gives me hope that I’m on the right track and points out new directions for growth.

I think this book has earned a permanent place on my shelf, just to skim every couple of years as a reminder of professional conduct.

Abject failure and banana bread

I haven’t been keeping up my baking posts! My new hobby hasn’t gone away. Here are some of my recent adventures in baking:

I had a bad run of underdone breads. I was trying wheat breads, and lower temperatures, and it just wasn’t working out. You can see how heavy this one is.

Loaf14

And another bust – check out the doughy center of this loaf. It was barely edible. I took a break from baking after this.

Loaf15

Loaf15crumb

Then, while house-bound on a particularly slow Saturday, I decided to go back to crispy white breads and try again. I mixed a large batch of dough with good bread flour, a little extra salt, and some olive oil, agave, and rosemary. I gave it plenty of time to rise. I determined to bake at 450° again. Unfortunately it flattened during the final rise and got folded on the way into the oven, and turned out looking like a giant croissant:

Loaf16

Silly shape aside, this was by far the best bread I’ve made! It had a crispy crust and a perfect bubbly crumb. The rosemary and salt helped create a nice robust flavor. I was glad it was a large loaf, it was a staple in our house for a couple of days. I’m also learning that a teaspoon of oil in your dough goes a really long way as a preservative.

The rosemary-mega-croissant was baked on a new baking stone my wife ordered. She also got a stoneware loaf pan for me to try, so I tried a white bread in the loaf pan. It was okay – a little like a fluffy salt cracker. I’ll probably use this pan next time I try wheat bread, since it can take a wet dough and might bake through better.

Loaf17

I also made a perfect vegan chocolate chip banana bread in my new loaf pan. Maybe it… disappeared… before I could reach the camera. I wish I had taken before-and-after photos though. As batter the pan was only half-full, but it rose so well that it blossomed over the top.

I do feel my intuition improving. I didn’t use a recipe for any of these breads, except for the banana bread where I cherry-picked ingredients from two different recipes. Next I’ll either make the banana bread again, or try to recreate the rosemary bread. It’s a pleasant rainy day in Seattle – I think I need to make some good soups to go with these breads.

Wayward

Wayward, currently in beta, is a survival game by Unlok. Think Minecraft, but with a classic JRPG look and more dying of thirst. You can fire it up in your browser, and it’s turn-based like an old roguelike, which makes it perfect for playing a few minutes at a time.

When Wayward begins, you are stranded on a small island with a few supplies and virtually no skills. Your goal is to find hidden treasure and get off the island. Of course, this is a survival game, so before you go hunting for treasure you’ll want to set up reliable food and water sources, and build a place to hide from bears.

Your character begins with a small crafting menu, which grows as you find new materials and practice your skills. You will cut down a lot of trees in this game, to get branches, to make bark strips, to make string, to make rope… you get the picture. The menu quickly grows large enough that the text search will come in handy.

I eventually got into a stable living situation, even trying to start a farm; this wouldn’t be a bad Harvest Moon replacement with better farming options. I went in search of treasure, but found none – the big dark cave on my island was empty. Since the game is still in beta, the wiki may be necessary to succeed. At that point my interest sort of ran out.

The good: I like survival and crafting games, and the in-browser turn-based nature of this one allowed me to play a few turns at a time. Being able to play a few turns would work well on mobile for me, as long as you can retrieve the context for what you were doing. The crafting options are extensive.

The bad: In time the game becomes an inventory management nightmare – limited stacks, weight limits, sub-containers and the necessity of stockpiling mean there’s way too much to keep track of and not much help to organize it. I never thought I’d turn to Dwarf Fortress for a usability lesson, but inventoried and searchable stockpiles are an awesome feature.

Wayward is free and worth a shot. My tip for getting started – you don’t need an ax, just hit trees with rocks to get going.

Broken Age: Act 1

As the sounds of an orchestra tuning up played behind the title screen, I realized that this is a game for grown-ups.

Broken Age, the Kickstarted adventure from Double Fine, is a story about questioning perspectives. Shay and Vella are each unhappy with the reality constructed for them. Shay struggles against a rubber-room world with an effort to introduce some real danger. Meanwhile, Vella faces danger enough as she fights back against a human sacrifice tradition. In each case a child challenges their upbringing, and sees the world differently.

It’s an apt story for a crowdfunded game with obvious roots in SCUMM engine adventures. Broken Age had every reason to be a childish nostalgia-fest. Eighty thousand backers invested in a classic point-and-click adventure. They’re getting what they asked for. And yet, Broken Age wants to see the world differently. It wants to grow up.

The first act is short, and its puzzles nigh trivial. I’m not sure that’s a bad thing. Broken Age is a videogame growing up into a work of drama. The puzzles are a carrot, subordinate to the story and helping to pull players along from one scene to another. The length is respectful of my time, something I can finish in a weekend or two. It’s dense, eschewing backtracking and fetch quests in favor of regular story beats.

Best of all, Broken Age is a game about characters. Videogames are usually a medium of verbs and spaces. I often feel that the environment is the most significant character in a game. Broken Age is different: Superb writing, voice work, and animation combine to create distinctive and memorable characters. Interactions with these characters are not complex, but they are the highlight of the experience – you play for the people.

It was worth the price of admission. I do think this story deserves three acts. But then, I have no idea what act two has in store.

Spoilers about the end of act 1 below:

About halfway through the game I guessed the connection between Shay and Vella. Marek’s viewscreen, the “rescues,” and the locked hold foreshadowed Shay’s emergence from Mog Chothra. Recognizing this early separated me from Shay’s character. It was obvious that he had walked out of one ruse and into another. But Shay’s new freedom blinds him, even when taking orders from a something-in-wolves’-clothing. While this made it harder to role-play as Shay, it also solidified his personality independent of the player. I’m curious to see how act two deals with his complicity in Vella’s trouble.

Loaf #13

This is my least attractive, most delicious bread so far.

I thought I had a disaster on my hands. My dough was too wet and wouldn’t shape. I lost about half of it trying, because it stuck to everything. At my wife’s behest we baked it anyway, and it flattened out into this focaccia-esque round. The flavor is good and the crumb is spongy.

This is 1/3 whole wheat flour and 2/3 all-purpose, with a drizzle of agave mixed in and a little olive oil and salt on top. Prep time was about six hours.

2014-02-16 Loaf 13 web

2014-02-16 Loaf 13 crumb web