Refactoring is reality-bending. Over and over, you change the status quo to align with a vision. It’s about “making the change easy”, one iteration at a time. But here’s the catch: each step creates a new reality. And that reality can trap you, just like the last one did. You lose sight of the vision.
Primitive Obsession is not called “Primitive Preference” for a reason: we can find ourselves clinging to primitives like addicts, even when every aspect of our project nudges us, hints, and screams that we should be doing something different. It’s never just “a string”. It’s never just “an integer”.
The metaphor of the “black box” is very common in programming. It is so general that it’s nearly meaningless; but it summarizes a lot of specialized principles nicely and shows a unifying principle. A black box is characterized by: It can be applied to “modules” on all levels of abstraction.
Recently, I was discussing adding a feature to an application which is about event creation and booking. The project manager has a strong database background and works on the schema himself. The schema is also his go-to tool to express changes in the features. But thinking about the real Domain in terms of objects revealed much, much more.