Quantcast
Channel: uttumuttu
Viewing all articles
Browse latest Browse all 10

Reuse as a Refactoring Strategy

$
0
0
There has been a strange pattern reoccuring in a lot of my development efforts. Often, when I write a component X acting as a backend ("server"), and a component Y acting as a frontend ("client") to X, a very good way to refactor the code is to write another component Z also acting as a frontend to X. You start to notice redundancies between the frontends Y and Z, so you move the redundancy towards the backend X: the dividing line between the responsibilities of the frontend and the backend becomes clearer.

In retrospect, this seems obvious: the best way to write reusable code is to reuse it. However, more paradoxically, I believe such deliberate reuse can be used as a refactoring strategy even if you never plan to use Z.

I wonder if this idea already has a name.

Viewing all articles
Browse latest Browse all 10

Trending Articles