liveBook · Manning

Seam

As explained in Build High Value Software Systems

A place in a software system where behavior can be altered or substituted without changing the code at that point.

A seam is a place where behavior can be changed without editing the code at that point. In legacy code, it lets you separate business logic from an external dependency so tests can run without real infrastructure. section 7.3.2

Substituting an external dependency

When business logic directly calls a database, API, or filesystem, put that dependency behind an interface or overridable method. Production uses the real implementation; a test supplies a mock. The business logic stays the same, while feedback can shrink from minutes to milliseconds. section 7.3.2

Add a seam where it reduces friction in a change path; the boundary has a cost, so consider how often the code changes and how much testing currently slows feedback. section 7.3.2

How Build High Value Software Systems covers it

How deep it goes
Defines seams and explains dependency substitution for tests, but provides no concrete implementation sample.
Examples
Uses database, API, and filesystem calls to illustrate dependencies replaced by mocks in tests.
What you can do after
Apply it via an interface or overridable method to substitute test dependencies while keeping business logic unchanged.
How it connects
Connects seams to legacy-code testing, dependency boundaries, interfaces, mocks, and characterization tests.

Also explained in

Compare how 3 books explain seam →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build High Value Software Systems. The section links point to the parts of the book it draws on.