Skip to content

Seams

A seam is a place where behavior can be altered without modifying the code itself - identifying and creating seams enables testing of otherwise untestable code by allowing dependencies to be substituted.

Tension Addressed

Isolation vs. Integration

Recognizable As

Constructor injection points; interface parameters; virtual methods that can be overridden; environment variables that change behavior; configuration that swaps implementations

Canonical Sources

Feathers, "Working Effectively with Legacy Code" (2004)

Transfers To

Extension points in frameworks; plugin architectures; strategy pattern; dependency injection containers

Seams make testing possible without modifying production code. Legacy code often lacks seams, requiring careful refactoring to introduce them. The types of seams (object, compile, link, preprocessor) vary by language, but the concept of "places to substitute behavior" is universal.