Feeds:
Posts
Comments

Assume you cut your hand in the kitchen, then didn’t notice for an hour and had to be rushed to the ER. You do this 3 times per day.

You spend most of your time in the ER and very little time cooking. You want to fix that.

The improve testing strategy says “we’re going to cut ourselves all the time. How could we notice that so that we don’t bleed out?”

So we write something that will check every minute to see whether we’ve cut our hand in any of the specific places we’ve cut ourselves before. Of course, if we cut ourselves in the leg, we still don’t notice it and we end up in the ER.

And then we start checking our leg. Over time we are catching many our cuts in time to put on a bandage. We spend less time in the ER, but we’re still all covered in bandages and spend a lot of time looking for wounds.

Safeguarding would instead ask “why are we cutting ourselves 3 times a day? Why is this kitchen so unsafe?”

So we look and realize that the tilted counters are causing knives to slide off, people lunge for them so that the knife isn’t ruined on the floor, and then they cut themselves.

Safeguarding is to flatten the counter top.

The Core 6 Refactorings

Not all refactorings are created equal. Some get used a lot more than others. This is especially true with highly-indebted code. There’s a reason for this. Sets of refactorings are commonly used together to solve classes of problems, and some problems are more common than others. If you are learning to refactor, learn your tool in sets.

The most important set to learn are the Core 6 Refactorings, plus 3 critical utility functions.

These 9 operations will allow you to do the most important part of working with indebted code: read by refactoring. Fluency in these 9 is all you need. Continue Reading »

Programmers are familiar with the DRY principle: Don’t Repeat Yourself. That’s great advice for production code. But tests are different. For tests, use WET: Write Explicit Tests. The two lead to different results. Let’s look at an example. Continue Reading »

In part 1 we talked about naming as a process. We talked about how legacy code is really defined by its poor legibility, and that reading is the core of coding. And we talked about how working effectively with legacy code is simply the process of having an insight, writing it down, and checking it in.

Later parts have gotten us to a name that conveys Intent.

Now let’s look deeply at the last transition in names, from Intent to Domain Abstraction. Continue Reading »

New code is legacy code

My series about naming as a process is really about design. It focuses on design in legacy code. That has sparked people to ask about new code.

What about new code? Why not start with intent? I was taught to pseudocode or model, so that I could focus on the intent first. Then I don’t need all this after-the-fact concept discovery stuff.

  1. I always write new code with intent.
  2. I am never wrong about my intent.
  3. I’m never right either.

Continue Reading »

We are not fucking competent

We are not fucking agile. Stop talking to me about Agile.

—Boss of one of my mentees, in a 1:1 career advice session.

Though I wasn’t in the room at the time, here is my response. Feel free to use it.

Continue Reading »

In part 1 we talked about naming as a process. We talked about how legacy code is really defined by its poor legibility, and that reading is the core of coding. And we talked about how working effectively with legacy code is simply the process of having an insight, writing it down, and checking it in.

Later parts have gotten us to a target that Does the Right Thing.

Now let’s look deeply at the fifth transition in names, from Does the Right Thing to Intent. Continue Reading »

In part 1 we talked about naming as a process. We talked about how legacy code is really defined by its poor legibility, and that reading is the core of coding. And we talked about how working effectively with legacy code is simply the process of having an insight, writing it down, and checking it in.

Later parts have gotten us to an Honest and Complete name.

Now let’s look deeply at the fourth transition in names, from Honest and Complete to Does the Right Thing. Continue Reading »

In part 1 we talked about naming as a process. We talked about how legacy code is really defined by its poor legibility, and that reading is the core of coding. And we talked about how working effectively with legacy code is simply the process of having an insight, writing it down, and checking it in.

Later parts have gotten us to an Honest name.

Now let’s look deeply at the third transition in names, from Honest to Honest and Complete. Continue Reading »

In part 1 we talked about naming as a process. We talked about how legacy code is really defined by its poor legibility, and that reading is the core of coding. And we talked about how working effectively with legacy code is simply the process of having an insight, writing it down, and checking it in.

Later parts have gotten us to a Nonsense name.

Now let’s look deeply at the second transition in names, from Nonsense to Honest. Continue Reading »

Older Posts »