Michael C. Feathers's Blog, page 2
February 28, 2019
The Cognitive Tech of Technical Discussions
How do you think?
It’s an odd question.
People think about thinking all of the time but they seldom talk about how ideas come to them. To the extent that I’m aware of my own process, I recognize that there’s a strong visuospatial component to my thinking. In my mind’s eye I see colors and shapes. When someone is talking, the shapes move. I think of the next question to ask. I build a picture — literally — of the problem.
I don’t know how typical this is. I do think in words too. If I hear...
December 6, 2018
Testing Yourself
These are interesting times for people who care about refactoring. The 2nd edition of Martin Fowler’s book Refactoring has just been released. As if that weren’t enough, Kent Beck recently wrote up a workflow called test && commit || revert, which can be seen as a new alternative to Test-Driven Development.
It might not be obvious why these two events are related, but if you take time to click through and read Kent’s write-up on the practice (and try it out), one of the things that y...
August 28, 2018
Orange Code
Whenever I work on unfamiliar code I start extracting methods. When I do this, I look for chunks of code that I can name - then I extract. Even if I end up inlining the methods I’ve extracted later, at least I have a way of temporarily hiding detail so that I can see the overall structure.
When I’m working with someone, often they point out thatI’m adding more code when I do these extractions. In terms of line count, they are right. An expression with 10 tokens on one line becomes three line...
July 28, 2018
Does Software Understand Complexity?
This past week I was at a conference with some wonderful talks, but I also enjoy the hallway track - the conversations you have with people during breaks. You trade experiences and eventually you get to the question: “what do you do?” My answer started with one word: software. The people I met had a range of reactions but often they spoke about the software they used daily and their frustrations with it. Then they described the programming that they do as part of their research and how engagi...
March 27, 2018
The Loss of Locality
One of the things about having kids is that their experiences put cultural change in sharp relief. You see the issues they deal with and think back to what you were doing when you were the same age.
Although my children are older now, I vividly remember conversations we had back when they were in elementary school and the stories that they would tell about what was happening.
A recurring theme was: a student getting suspended or expelled for doing something that seemed mild to me. It was c...
February 22, 2018
Breaking and Mending Compatibility
We often think that backward compatibility is hard, but actually it’s rather easy. Any project with users has a built-in mechanism for maintaining backward compatibility — people complain when it’s broken. That’s how you know. And, most of the time they let you know quickly.
The problem with this is that users can force unwanted backward compatibility on you.
Hyrum’s Law states:
With a sufficient number of users of an API,
it does not matter what you promise in the contract,
all observable...
January 2, 2018
Negative Architecture
You’ve probably seen this picture before. It’s one of several images that people use to show how perception works. You either see a vase or two faces looking at each other. In the terminology of Gestalt Psychology, one becomes the figure and the other becomes the ground. We can switch between the vase and the faces but we can’t see both at once. The distinction we automatically make is that one is the figure, the object of our perception, and the other is the background, or ground.
It might...
November 15, 2017
10 Papers Every Developer Should Read
(This is a requested repost of a lost blog I wrote in 2009. I'd change a few things, but not many)
I spent most of yesterday afternoon working on a paper I’m co-writing. It was one of those days when the writing came easy. I was moving from topic to topic, but then I realized that I was reaching too far backward – I was explaining things which I shouldn’t have had to explain to the audience I was trying to reach.
When I first started writing, one of the pieces of advice that I heard was t...
October 20, 2017
Knowing What Is There
If you want to know about the mechanics of refactoring there are quite a few resources out there. You can even find resources that outline refactoring strategy. But what about mindset? Is there a refactoring mindset that people should be aware of? I think that there is.
A while ago I was working with a team. We had time to refactor and we were all onboard with the effort. We wrote tests and tried to clarify the design. As we did we discovered things. It was like having everything come into fo...
July 11, 2017
Converting Queries to Commands
When methods focus on a single responsibility, they fall into two broad categories. They are either queries that compute and return some value without producing side effects, or they are commands that change the state of the world or the state of the object they are on.
The former style is more common in functional programming. In fact, we can say that functional programming is all about organizing our code around pure queries. In contrast, OO biases toward methods that return void. We call...