Refactor Congested Code with the Splinter Pattern

The splinter pattern provides a structured way to break up hotspots into manageable pieces that can be divided among several developers to work on, rather than having a group of developers work on one large piece of code. You use the splinter pattern to improve code that’s gone too far over the edge of complexity.

The main reason a piece of code grows into a hotspot is because it has accumulated several central responsibilities. As a consequence, the hotspot has many reasons to change. This leads to a downward spiral where every interesting new feature has to touch the hotspot code, which reinforces its change rate by adding yet another responsibility. Unless we catch that downward spiral early—for ...

Get Software Design X-Rays now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.