Understanding before abstraction

Let the repetition tell you what belongs together.

Sample writing

Two pieces of code can look alike without being the same idea.

Pulling them into a shared abstraction feels tidy at first. Then one use case changes, a flag appears, and a simple function begins accumulating exceptions.

A little duplication can be useful while the problem is still becoming clear. It gives each case room to reveal its own shape.

When the same change keeps happening in the same places for the same reason, the boundary becomes easier to see. That is a much better moment to bring things together.

The goal is code that is easy to change when your understanding improves.