We recently made a dramatic improvement to our kitchen that got me thinking about software design and the striking difference between cleaning code and remodeling it.
Sophia, one of my daughters, is at one end of our kitchen, next to a wall that connects our kitchen with our dining room.
Above Sophia’s head, there are pots and pans hanging from a shelf with hooks.
Those pots and pans are a good 6 feet away from our stove (not shown).
On the right, there is a doorway that leads to the dining room.
Here are a few facts that aren’t so obvious from the photo:
- We spend a good deal of time in our kitchen and dining room.
- You can’t easily talk to people in the dining room if you’re in the kitchen.
- The kitchen has three windows on one wall.
- There is some light that comes in from the doorway, but not much.
We’ve lived in our home for nearly a decade and have done little to no remodeling.
We aren’t handy when it comes to remodeling and we’re a bit afraid of it, given that we know people who have gotten into financial debt from the escalating costs of significant remodels.
Nevertheless, a recent water leak in our laundry room led us to remodel that room, with the help of some insurance money.
That remodeling really improved the design of the laundry room and adjoining family room.
So my wife suggested that we not wait another ten years to do more remodeling.
She wanted to tear down the wall between the kitchen and the dining room.
Rather than removing the entire wall, we agreed to cut out a large section from it.
We found out that the price to do that work wasn’t expensive at all, so we decided to go for it.
Here’s what it now looks like:
Our pots and pans now hang from a place that is next to the stove.
Both rooms now feel a lot more spacious.
We now have a view from our kitchen that we didn’t have before.
We can now actually talk to people while we cook and they sit in the dining room.
One thing that isn’t visible in the photo is that we now spend even more time in the kitchen and dining room, since the design of both rooms is far more inviting.
Now please look at the photo below.
See how the new arch emulates the arch in the dining room window and the arch in the passage to the dining room (far right)?
The change we made to the wall made the design more consistent with the rest of our home, which has arches in numerous rooms.
This remodel has transformed the design of an important area of our home.
So how does this relate to software design?
When Cleaning Is Not Enough
Cleaning code is far different from remodeling it.
Extracting, renaming, pulling up, pushing down are all moves we make when we refactor.
Yet refactoring that cleans up a design is different from refactoring that thoroughly transforms a design.
The other day, a programmer at a company I was visiting said to me “We make plenty of low-level refactorings but we don’t feel like our design is improving.”
That programmer and his colleagues do Test-Driven Development (TDD).
TDD includes a refactoring step, in which you improve the design of the code without changing its behavior.
That often results in cleaner code, which is a good thing.
Yet it seldom results in remodeling.
I remodel far less frequently than I clean.
Yet I do reflect on what part of our software design is inhibiting development (particularly in critical areas of our product) and, independent of TDD, I spend time refactoring that code to fundamentally improve its design.
So I leave you with this advice:
Clean frequently and remodel occasionally to produce an excellent design.