CS PAPERS DEEP-READ · PAPER 43

On Decomposing Systems into Modules · Information Hiding

David Parnas · Carnegie Mellon · CACM 1972

中文 →

What did this paper do?

Splitting a big program into pieces (modules) is a near-universal step in building software. But in 1972, David Parnas pressed a question nobody had really answered: by what criterion should you make the cut? His answer, information hiding, is exactly why you can quietly swap out one module without disturbing the rest, why a large team can each build their own part, and why words like "object-oriented" and "API" exist at all.

How people usually cut it

The most natural cut is by processing step: the program reads input, then processes, then sorts, then outputs — so make one module per step, slicing along the flowchart. It sounds obvious, and almost every beginner does it.

The trouble with that

The catch is that these "by-step" modules all share an unspoken secret: how the data is laid out in memory (how a line is stored, how a word sits). The day you want a more memory-efficient layout, you find nearly every module has to change too — because each one reaches directly into that data format. Pull one thread and the whole thing moves; this is the root of why software is hard to change and hard to divide up.

Parnas's idea

He said: don't cut by step — cut by "secret." First sit down and list which design decisions are most likely to change later (how data is stored, which sort algorithm, what format the external data has…). Then seal each such decision inside its own module, known only to that module. Any other module that wants to use it can only deal with it through a "window" (a set of agreed-upon functions), and can never see how it's implemented behind that window.

Why this works

Think of a module as a restaurant kitchen. You (the other modules) only order and pick up at the service window; what pans they use, what recipe they follow, how they plate it, is the kitchen's secret, kept behind closed doors. If the kitchen swaps its stove or changes its method, as long as the same dish still comes out the window, you never need to know, and don't change a single line. The change is sealed in one room and can't leak out — and everyone can run their own room in parallel, needing only to agree in advance on what the windows look like.

Remember one thing

Don't split modules by "the program's processing steps" — split by "the design decisions most likely to change." Each module hides one such "secret" and exposes only a stable window (an interface) to the rest. Change stays contained, and teams can each build their own part. This criterion grew into encapsulation, abstract data types, object-oriented programming, and the API.

(One honest cost: you have to guess right about "what will change." Guess wrong and you've hidden things that never change — wasted effort — or over-engineered for a change that never comes.)

Want the side-by-side of the two decompositions, the KWIC example, and how it grew into OOP? → switch to the deep read