About this book
A Philosophy of Software Design is a short book by John Ousterhout, a professor of computer science at Stanford University. It was first published in 2018 by Yaknyam Press, a small imprint, and a second edition with added and revised material appeared in 2021. Compared with most books in this bay it is slim, and it reads quickly. Its brevity is part of its message.
The book addresses what its author considers the most important unsolved problem in software practice: how to decompose a large system into parts so that the whole remains understandable and changeable as it grows. Ousterhout observes that programming courses teach students how to write code that works, and many books teach particular techniques, patterns or processes, but very little teaching addresses design itself in a direct way. Students and professionals alike learn design mostly by trial and painful error. The book is an attempt to name the principles that good designers follow, so that they can be taught.
Its organising claim is that the central problem of software design is complexity. Nearly every difficulty in building and maintaining software, from slow progress to frequent bugs, comes from the system becoming too complicated for the people working on it to hold in their heads. Good design is therefore, almost by definition, design that reduces complexity. Every principle in the book is a way of keeping complexity down or of pushing it to places where it does less harm.
The book grew out of a course. At Stanford, Ousterhout teaches a software design class in which students build substantial programs in small teams, receive detailed reviews of their code, and then revise their designs in response. This cycle of build, review and redesign gave him a large number of examples of how student designs go wrong and how they improve. Many of the book's examples, including a text editor and an HTTP server, are drawn from the projects in this class. The book reads like what it is: the distilled comments of an experienced reviewer who has seen the same mistakes many times.
Its intended readers are working programmers and students who already know how to write code and want to write better-structured code. It does not teach a language or a framework. Examples appear in Java and C++ and occasionally in other languages, but they are short and illustrate principles rather than technique. A reader who has worked on a codebase of any real size, and has felt the frustration of a change that should have been simple turning into a week of work, will understand immediately what the book is about.
The book is also, as its title signals, a statement of opinion. Ousterhout says plainly that some of his views are controversial and that they contradict advice found in other popular books. He disagrees, for example, with the fashion for very short methods and very small classes, and with the view that good code needs no comments. He presents these disagreements openly, which makes the book more useful: a reader can see exactly where a choice is being made and judge it.
The author
John Ousterhout has had a long career that crosses academia and industry, and it bears directly on the authority of this book. He did his doctoral work at Carnegie Mellon University and then taught for many years at the University of California, Berkeley. There he led work on a distributed operating system called Sprite, and in that project he and his student Mendel Rosenblum developed the log-structured file system, an idea that influenced storage design for decades and that readers of Kleppmann's book on this shelf will recognise in modern storage engines.
At Berkeley he also created Tcl, a scripting language designed to be embedded in applications, and Tk, a toolkit for building graphical interfaces that became widely used far beyond its original language. Tcl's design was itself an exercise in the ideas of this book: a small, simple interface that let programmers glue powerful components together. Its long life and wide use gave Ousterhout experience of maintaining a large system used by many people over many years.
He later left academia for industry, working at Sun Microsystems and then founding companies built around Tcl and around software build tools. He returned to academia at Stanford, where his research turned to large-scale systems, including RAMCloud, a storage system that kept all data in memory across many servers, and the Raft consensus algorithm, developed with his student Diego Ongaro, which was designed above all to be understandable. That last point is telling. Raft was created because an earlier consensus algorithm was widely regarded as correct but very hard to understand and to implement. Ousterhout and Ongaro treated understandability as a primary design goal, and Raft became widely adopted partly for that reason. The same value drives this book.
His career thus gives him two vantage points. He has written and maintained large systems himself, over decades, in research and in commercial settings. And he has taught many students, seeing their designs at an early stage and watching how they improve under review. The book draws on both. Its confidence comes from experience; its clarity comes from teaching.
He has also been willing to debate publicly. After the book appeared, he engaged in exchanges with Robert C. Martin, the author of Clean Code, about their differences on method length, comments and test-driven development. These exchanges made explicit what the book already implied: that there are genuine disagreements among experienced practitioners about what good code looks like, and that they can be argued about with reasons.
The shape of the argument
The book is organised as a sequence of short chapters, each built around one principle or one recurring problem. It begins by defining complexity and its causes, then argues for a particular attitude toward programming work, and then spends most of its length on principles for structuring modules and interfaces. Later chapters turn to the details that make code readable, such as comments, names and consistency, and to the relationship between design and process. The book closes with a summary of its principles and a list of red flags, symptoms that a design has gone wrong.
The argument moves from diagnosis to treatment. First Ousterhout establishes what the disease is: complexity, which he defines in terms of its effects on the people who work with a system. He identifies its sources, which turn out to be few. Then he describes the mindset needed to fight it, since he argues that no technique helps if programmers are not willing to invest in design. Only then does he turn to specific techniques.
The middle chapters, which form the core of the book, are about modules. A module here means any unit of code with an interface and an implementation: a class, a function, a service, a subsystem. Ousterhout argues that the most important thing about a module is the relationship between how much it does and how much its users must know in order to use it. A good module does a lot and asks little. From this single principle, he derives a series of more specific guidelines about how to divide functionality, how to design interfaces, how to handle special cases and errors, and how to arrange layers.
The later chapters move closer to the text of the code. They discuss comments at length, arguing that comments are a design tool and not a sign of failure. They discuss names, consistency and the goal of making code obvious to readers. They also discuss how design fits with practices such as agile development, test-driven development and the use of design patterns, offering cautious and sometimes critical views.
Throughout, the book uses red flags as a recurring device. Each chapter ends by naming one or more symptoms that a reader can spot in code: a sign that information is leaking between modules, that a method is a mere pass-through, that a comment repeats the code. These red flags make the principles practical. A reader may not remember an argument word for word, but can remember to look for a symptom and then ask what principle it violates.
The structure is cumulative but not rigid. Most chapters can be understood on their own once the opening chapters on complexity are read. This makes the book suitable for rereading in pieces, which is how many readers use it.
Idea one: what complexity is
Ousterhout begins with a practical definition. Complexity is anything related to the structure of a software system that makes it hard to understand and modify. This definition is deliberately about people, not about code in the abstract. A system is complex if the people who work on it find it hard to work on. A large system that is easy to understand is not complex in this sense, and a small system full of hidden traps can be very complex.
He adds a refinement. The overall complexity of a system can be thought of as the complexity of each part weighted by how much time developers spend working on that part. A horribly complicated piece of code that nobody ever needs to touch adds little to the burden. A slightly awkward interface that everyone uses every day adds a great deal. This weighting explains why the book cares so much about interfaces: they are the parts most people touch most often.
Complexity shows itself in three ways. The first is change amplification: a change that seems simple requires modifications in many places. If changing the colour of a banner means editing every page of a website, the design suffers from change amplification. The second is cognitive load: how much a developer needs to know in order to complete a task. An interface that requires the caller to remember many rules, manage resources carefully and call functions in a precise order imposes high cognitive load. The third, and the worst, is unknown unknowns: it is not obvious what code must be changed or what information must be known to make a change correctly. With the first two, a developer at least knows what to do, even if it is tedious. With the third, the developer may make a change, believe it complete, and introduce a bug that appears much later.
He then names two causes. Dependencies exist when a piece of code cannot be understood or modified in isolation, because it relies on other code. Some dependencies are unavoidable; the aim is to make them few, simple and obvious. Obscurity exists when important information is not apparent: a variable with a vague name, a rule that is not documented, a behaviour that depends on something far away. Dependencies cause change amplification and cognitive load. Obscurity causes unknown unknowns and cognitive load. Nearly every specific principle in the rest of the book is a way of reducing one or both causes.
Finally he makes a point about how complexity accumulates. It does not usually arrive in one large decision. It builds up in many small ones, each of which seems harmless. One extra parameter, one special case, one quick workaround: none is a disaster. But hundreds of them together make a system that nobody can change safely. Because each increment is small, it is easy to justify, and that is precisely why complexity is so hard to fight.
An analogy is clutter in a house. No single object makes a room unusable. But each item left out because putting it away would take a minute adds to a pile, and eventually the room cannot be cleaned or used without first moving everything. The cure is not one big tidy-up but a habit of not leaving things out.
This idea is often confused with size or with difficulty of the problem. A system solving a hard problem may need to be large and sophisticated, but it need not be complex in Ousterhout's sense if its structure lets people work on parts in isolation. Where it leads is to a single question that can be asked of any design decision: does this make the system easier or harder for the next person to understand and change?
Idea two: strategic rather than tactical programming
Before any technique, Ousterhout addresses attitude. He distinguishes two ways of approaching programming work. In tactical programming, the main goal is to get something working: finish the feature, fix the bug, ship. Design is considered only as far as it affects the immediate task. In strategic programming, the main goal is to produce a great design that also happens to work. Working code is necessary but not sufficient.
Tactical programming is the natural default, especially under deadline pressure. Each tactical shortcut saves a little time now and adds a little complexity. Because complexity is incremental, as the previous chapter showed, the tactical programmer rarely sees the cost of any one decision. Over months and years, the accumulated complexity slows everyone down, and eventually the system becomes so hard to change that progress nearly stops.
Ousterhout describes a figure many readers will recognise: the programmer who produces code very quickly, often admired by management for speed, but who leaves behind a trail of shortcuts that others must later clean up. He suggests that such people are often regarded as heroes when they are in fact a source of long-term damage, because the cost of their speed is paid by colleagues later.
Strategic programming requires an investment mindset. Ousterhout suggests that a reasonable investment is to spend a modest fraction of development time, he suggests something on the order of ten to twenty percent, on improving design: thinking about alternatives before committing, cleaning up structure when a problem is noticed, writing good documentation. This slows initial progress slightly. But because the system remains easier to change, progress over the long run is faster. The two curves cross fairly soon, and after that the strategic approach pulls ahead steadily.
He applies this to companies as well as individuals. Startups often feel they must move fast at any cost, and they frequently build up so much complexity in their early code that later development becomes very slow. Ousterhout argues that a culture of good design is a competitive advantage, since it attracts good engineers and keeps the cost of change low. He contrasts companies known for strong engineering cultures with those that accepted messy early code and paid for it later, though he presents these as illustrations rather than proofs.
An analogy is personal finance. Spending everything you earn feels efficient in the short run. Saving and investing a fixed part of income feels like a loss at first, but over years the returns compound. Tactical programming is living paycheck to paycheck; strategic programming is regular saving.
This idea is often confused with perfectionism or with big up-front design. Ousterhout is not asking programmers to design everything in advance or to polish code endlessly. He supports incremental development. What he asks is that each increment be designed with care, and that when a design problem is found, it be fixed rather than worked around. It is also confused with a rejection of deadlines. Strategic programmers still ship; they simply do not treat every deadline as an excuse to add mess.
Where it leads is to a different way of evaluating programmers and teams. Speed of initial delivery is easy to see. The quality of the structure left behind is harder to see but matters more. A team that values strategic programming will review designs, reward cleanup and treat complexity as a cost to be justified, not a by-product to be ignored.
Idea three: deep modules
The book's most famous idea is that modules should be deep. Imagine a module as a rectangle. The top edge is its interface, everything a user of the module must know: the names, parameters, behaviours, side effects and rules. The area of the rectangle is its functionality, everything the module actually does. A deep module has a small interface and a large area: it provides a great deal of functionality behind a simple surface. A shallow module has a large interface relative to what it does: users must learn a lot to get a little.
The interface is a cost, because every user must understand it. The functionality is a benefit, because users get it without understanding its implementation. A deep module gives a large benefit for a small cost. A shallow module may even have a cost greater than its benefit, adding to the overall complexity of the system rather than reducing it.
Ousterhout's favourite example of a deep interface is the classic Unix approach to file input and output. A handful of basic operations, to open, read, write, move to a position and close, give programs access to files without any knowledge of disk blocks, directories, caching, permissions, device drivers or concurrent access. Behind those few calls lie a vast amount of carefully engineered code. Users benefit from all of it while learning almost nothing.
As a counterexample he points to file input in Java as it was traditionally used, where reading a file with buffering required creating several separate objects and wrapping them together, because each class handled one small concern. Each class was simple, but the combination asked the programmer to know about several classes and to remember to add buffering, which most callers wanted anyway. He argues that the common case should be simple and that features nearly everyone needs, such as buffering, should be provided by default.
This leads to his criticism of a popular style. Some programming advice holds that classes should be very small and methods should be only a few lines. Ousterhout argues that this, taken to an extreme, produces many shallow modules. Each one is easy to understand alone, but the system as a whole has an enormous number of interfaces, and understanding any real behaviour requires tracing calls across many tiny pieces. He calls this tendency classitis. Length is not the issue in itself. A long method that does one coherent thing with a simple interface may be better than a cluster of short methods that must be understood together.
An analogy is a car. A driver uses a steering wheel, two or three pedals and a few controls. Behind them lie an engine, transmission, braking system and electronics of great complexity. That is a deep interface. Imagine instead a car in which the driver had to operate the fuel injection, the clutch timing and each brake separately. The parts might be simpler individually, but driving would be much harder.
This idea is often confused with simply making modules large. Size is not depth. A large module with a sprawling interface is still shallow. Depth is a ratio: much hidden, little exposed. It is also confused with hiding everything; some information must be exposed for a module to be useful. Where it leads is to a standard for evaluating any class, function, library or service: what does a user have to know, and how much do they get for knowing it?
Idea four: information hiding and its opposite
Depth is achieved mainly through information hiding, an idea Ousterhout credits to David Parnas, who argued in the early 1970s that systems should be divided into modules according to the design decisions each module hides. Each module should encapsulate some knowledge: a data format, an algorithm, a protocol, a policy. That knowledge appears in the module's implementation but not in its interface. Other modules can use the module without knowing it, and the decision can change without affecting them.
The value of this is twofold. It reduces cognitive load, because users of a module need not learn what it hides. And it reduces dependencies, because a hidden decision can change without forcing changes elsewhere. If the format of a configuration file is known only to one module, changing the format affects only that module. If ten modules each parse the file themselves, every one must change.
The opposite of information hiding is information leakage, which occurs when a design decision is reflected in more than one module. Leakage creates a dependency: change the decision, and all the modules that know about it must change together. Some leakage is obvious, as when an interface exposes internal details. Some is subtle, as when two modules both depend on the same file format or the same assumption about order, without either interface mentioning it. Ousterhout calls this back-door leakage and regards it as particularly dangerous, because it is invisible in the code's structure.
A common cause of leakage, he argues, is temporal decomposition: structuring a system according to the order in which things happen. A program that reads a file, modifies its contents and writes it back might be split into a reading module, a modifying module and a writing module. But the reading and writing modules both need to know the file format, so the format leaks across two modules. A better decomposition groups by knowledge rather than by time, putting everything about the file format in one place. In designing modules, the question to ask is what knowledge each module needs, not what order things happen in.
He also notes leakage within a class. Even inside a single module, splitting it into many small pieces that each know part of a shared secret can spread knowledge unnecessarily. And he warns against exposing internal data structures through getters and setters as a reflex, since doing so lets callers depend on the representation.
An analogy is a household where only one person knows how the heating system works. Everyone else simply sets the thermostat. If that person replaces the boiler, nobody else needs to know. Now imagine that three family members each learned to adjust valves directly. Replacing the boiler would then require retraining all three, and any one of them might damage the new system by applying old habits.
This idea is often confused with access modifiers such as private and public. Declaring fields private is a mechanism, but it does not by itself hide a design decision; a class can have entirely private fields and still leak its design through the shape of its methods. Information hiding is about which knowledge is needed where, not about keywords. It is also confused with hiding everything, which would make a module useless. The skill lies in choosing what to expose: the minimum needed for common uses, presented as simply as possible.
Where it leads is to a way of reviewing designs. For each important decision in a system, ask how many modules know about it. If the answer is more than one, ask whether that is necessary. Reducing the count is usually the single most effective way to make a system easier to change.
Idea five: general-purpose interfaces and distinct layers
A recurring question in design is how specialised a module should be. One approach builds exactly what today's feature needs and nothing more. Another builds a general mechanism that could serve many future uses. Ousterhout recommends a middle position: modules should be somewhat general-purpose. Their functionality should reflect current needs, but their interface should be general enough to support several uses rather than being tied to one.
His main example comes from the text editor project in his course. Students often designed the text class with methods tailored to specific user interface actions, such as a method for what happens when the backspace key is pressed or when a selection is deleted. This tied the text module to the user interface, so that every new interface feature required a new text method, and knowledge of the interface leaked into the text module. A better design gave the text class a small set of general operations, such as inserting characters at a position and deleting a range, from which all the specific behaviours could be built in the user interface code. The general version was simpler, deeper and easier to reuse.
He offers questions to guide this choice. What is the simplest interface that covers all current needs? In how many situations will a method be used? Is this interface easy to use for current needs? If a method is used in only one place, it may be too specialised. If the interface requires many methods for slight variations, it may be possible to merge them.
Related is the principle that different layers should provide different abstractions. Systems are often built in layers, each using the one below. If two adjacent layers have similar abstractions, the upper layer adds little and is probably shallow. A symptom is the pass-through method, which does nothing but call a method with the same signature in another layer. Pass-through methods add interface without adding functionality. Similar symptoms include pass-through variables, which are handed down through many layers just to reach the one that uses them, and decorators that wrap an object only to add a small feature.
Ousterhout also states a principle he calls pulling complexity downward. When some complexity is unavoidable, it is usually better for the module's implementer to absorb it than for every user to deal with it. A module has one implementer and many users. If the implementer works a little harder to make the interface simple, every user benefits. The common error is to push decisions upward, for example by exposing many configuration parameters and leaving users to choose, when the module could choose sensible values itself. Configuration parameters can be useful, but each one is a small piece of complexity exported to users.
An analogy is a general-purpose kitchen tool such as a good knife, compared with a drawer full of single-purpose gadgets for slicing eggs, coring apples and cutting herbs. The knife has a simple interface and covers many uses. The gadgets each do one thing, and together they make the drawer harder to use. But a knife that tried to be a can opener, a corkscrew and a saw would be worse than either.
This idea is often confused with building frameworks speculatively. Ousterhout warns against generality for its own sake. The aim is a general interface for present needs, not a mechanism for imagined future needs. Where it leads is to modules whose interfaces are cleaner than the special cases they serve, and to systems where each layer genuinely adds something.
Idea six: defining errors out of existence
Exceptions and error handling are, Ousterhout argues, one of the worst sources of complexity in software. Code that handles errors is often a large share of the total, it is rarely exercised, and it is therefore poorly tested and full of bugs. Moreover, every exception a module can throw is part of its interface; callers must know about it and decide what to do. A module that throws many exceptions is a shallow module in disguise.
His most distinctive suggestion is to define errors out of existence. Rather than detecting an unusual condition and reporting it as an error, design the operation so that the condition is not an error at all. An example from his own experience with Tcl concerns a command for deleting a variable. In the original design, deleting a variable that did not exist was treated as an error. In practice, callers almost always wanted only to make sure the variable was gone, and they had to write extra code to handle the error. Ousterhout came to regard this as a mistake. If the operation is defined as ensuring the variable does not exist, then deleting a non-existent variable simply succeeds, and the error disappears along with all the code written to handle it.
He gives other examples of the same kind. A function that extracts part of a string could reject indexes that fall outside the string, or it could simply return the overlapping part, which is often what callers wanted. Operating systems differ in whether a file that is open can be deleted; one design forbids it and produces errors, another allows it and handles the consequences internally, letting the file disappear once the last user closes it. In each case, a change of definition removes a class of error.
When errors cannot be defined away, he suggests other techniques. Masking handles an error at a low level so that higher levels never see it, as network protocols do when they retransmit lost packets. Aggregation handles many different errors in one place, rather than scattering handlers across the code. And for some conditions that are truly rare and unrecoverable, the simplest response may be to stop the program, rather than writing elaborate recovery code that will never be tested properly.
An analogy is a door. One design locks automatically and requires a key every time, generating many small failures when people forget keys. Another has a code pad, so nobody can forget a key. The second does not handle the error of forgetting a key better; it removes the possibility of that error.
This idea is often confused with ignoring errors. Ousterhout is not advocating silence when something has truly gone wrong. He is advocating careful thought about which conditions are genuinely errors from the caller's point of view and which are merely inconvenient cases that the module could handle sensibly. It is also confused with hiding problems that callers need to know about, which would be a failure of information, not a success of design. Where it leads is to interfaces that are smaller, code that is shorter and fewer bugs in paths nobody tests.
Idea seven: design it twice
A short but valuable principle in the book is to consider more than one design for any significant decision. When designing a module or an interface, sketch at least two quite different approaches before choosing. Compare them on simplicity of interface, generality, efficiency and how well they hide information. Often the comparison reveals a third design better than either.
Ousterhout explains why this is necessary. The first idea that comes to mind is rarely the best. Smart people in particular are used to their first ideas being good enough, because in school that was usually true. But design problems are harder than school problems, and the first idea often carries hidden weaknesses that only become visible when set beside an alternative. Comparison is how we see.
The cost is small. Sketching an alternative interface takes perhaps an hour or two, a tiny fraction of the time that will be spent implementing and maintaining the module. The benefit can be large, because a better interface saves effort for every future user. Ousterhout reports that he has applied this to his own work, including the design of Tk's interface, and that the alternative designs he considered improved the final result even when they were not chosen.
The exercise also builds skill. Designers who habitually compare alternatives learn to recognise the qualities that make one design better than another. Over time they get faster and their first ideas get better, because they have internalised the comparison.
An analogy is shopping for a home. Someone who visits a single flat and signs the lease may be happy, but someone who visits three will understand the trade-offs, notice what matters to them and probably choose better, even if they end up choosing the first flat after all.
This idea is often confused with prototyping or with lengthy design reviews. It is lighter than either. It requires only the discipline to stop before committing and ask what a radically different approach would look like. Where it leads is to better designs at low cost and to designers whose judgement improves with every comparison.
Idea eight: comments as part of design
Ousterhout devotes several chapters to comments, more than most design books, and his position is one of the book's most contested. He argues that good comments are an essential part of good design, and he rejects the common view that well-written code is self-documenting and that comments are a sign of failure.
His argument rests on a simple observation. Code can express what a program does, step by step, but it cannot express everything a reader needs. It cannot easily express why a decision was made, what an interface promises at an abstract level, what assumptions hold, what units a value is in, or what the designer intended a module to be. An interface, in particular, cannot be described by its implementation, since the whole point of an interface is that users should not need to read the implementation. Without comments, users must read the code anyway, which defeats the abstraction.
He distinguishes kinds of comments. Interface comments describe what a module or method does and how to use it, without describing how it works. Implementation comments explain what is happening inside, at a level above the individual lines. Comments on variables and fields say what they represent, in what units, and what invariants hold. Cross-module comments describe dependencies that span modules. He insists that comments should describe things that are not obvious from the code, and that a comment which merely repeats the code adds nothing.
His most practical suggestion is to write comments first. Before implementing a class or method, write its interface comment. If the comment is hard to write, or long and complicated, that is a sign that the design is poor: a deep module should be easy to describe briefly. Writing the comment first turns documentation into a design tool, a way of testing an abstraction before committing to it. It also ensures the comments get written, since they are much less likely to be written after the code.
An analogy is the label on a medicine bottle. The pills do what they do regardless of the label. But a user cannot know the dose, the timing or the interactions by examining the pills. The label is not a sign that the pills are badly made; it is what makes them safely usable.
This idea is often confused with the practice of writing a comment for every line, or with outdated comments that contradict the code. Ousterhout opposes both. He asks for fewer, better comments placed where they carry information that code cannot. He addresses the problem of comments becoming stale by advising that they be kept near the code they describe and updated as part of every change. Where it leads is to code whose abstractions are visible on the page, and to a design habit in which describing an interface clearly comes before building it.
Idea nine: names, consistency and obviousness
The later chapters of the book descend from architecture to the texture of code, but they keep the same goal. Names matter because they are a form of documentation that appears everywhere a thing is used. A good name creates an image in the reader's mind that matches what the thing actually is. A vague name such as one meaning simply data or result forces the reader to look elsewhere to find out what is meant. A name that is precise but wrong is worse, since it misleads. Ousterhout suggests that if a good name is hard to find, the design may be unclear: the thing may be trying to be several things at once.
Consistency reduces cognitive load because once a reader learns a pattern, they can apply it everywhere. If similar things are named similarly, if similar operations follow the same conventions, and if code is formatted in the same way, readers can make safe assumptions. Inconsistency forces them to check each case. Ousterhout recommends documenting conventions, enforcing them with tools where possible, and resisting the urge to introduce a better convention in one place while leaving the old one elsewhere, since two conventions are often worse than one imperfect one.
Obviousness is the summary goal. Code is obvious if a reader can understand it quickly, and if their first guesses about its behaviour turn out to be right. Things that make code less obvious include event-driven structures where it is hard to see what happens when, generic containers that hide the meaning of their contents, and code that violates reader expectations. The judge of obviousness is not the author but the reader; if reviewers find code confusing, it is confusing, however clear it seemed to the person who wrote it.
These chapters also contain Ousterhout's views on some popular practices. He is sceptical of design patterns used as ends in themselves, which can add structure without reducing complexity. He has reservations about test-driven development, arguing that writing tests first focuses attention on getting specific features working rather than on finding the best design, which encourages tactical programming. He supports unit testing strongly but sees it as a tool, not a design method. He is cautious about letting performance concerns drive design, suggesting that simple designs are often fast and that the critical path should be identified by measurement before being optimised.
An analogy is signage in a building. Clear names on doors, consistent symbols for exits and lifts, and a layout that matches visitors' expectations let people find their way without asking. A building with inconsistent signs and surprising corridors requires a guide, however well constructed it is.
These ideas are often confused with style preferences, of the kind argued about endlessly in code reviews. Ousterhout's point is that they are not matters of taste when they affect how quickly and accurately people understand code. Where they lead is to a standard for code review: not whether code follows a rule, but whether a new reader would understand it correctly and quickly.
Idea ten: keeping design alive as code changes
Most software is not written once. It is changed, again and again, by people who were not present when it was first designed. Ousterhout treats this as the real test of a design philosophy. A system that starts clean but decays with every change has not been well designed in any lasting sense. The question is how to keep the strategic attitude alive during ordinary maintenance, when the pressure is always to make the smallest possible change and move on.
His advice is that each change should leave the design as it would have been if the system had been built with that change in mind from the start. When adding a feature, the tactical temptation is to find the least disruptive place to insert a special case: an extra flag, an extra branch, an extra parameter threaded through a few methods. Each such insertion is small, and each makes the system slightly more complicated. The strategic alternative is to ask whether the existing structure is still the right one now that this feature exists. Sometimes the answer is yes, and the change fits naturally. Sometimes the answer is no, and the right response is to restructure a little so that the new feature becomes an ordinary case rather than an exception.
This is not a call for constant rewriting. Ousterhout accepts that time is limited and that large restructuring is not always possible. But he argues that the habit of asking the question, and of making modest improvements whenever they are cheap, keeps a codebase from sliding steadily into disorder. A small investment at each change is far cheaper than a large rescue later.
Comments deserve particular care during change. A comment that described the code accurately when written becomes harmful once the code changes and the comment does not. Ousterhout suggests keeping comments close to the code they describe, so that anyone changing the code sees them, and avoiding duplication of documentation in several places, since duplicated text is unlikely to be updated everywhere. He also suggests that commit messages are a poor place for information future readers will need, since few people look there; important explanations belong in the code.
In its later edition the book also places weight on a broader skill: deciding what matters. Good design involves separating the few things that are important from the many that are not, and organising the system around the important ones. An interface should emphasise what most users need and make it easy, while less common needs can be met with a little more effort. A comment should state the essential point first. A system should make its central concepts prominent rather than burying them among incidental details. Much bad design, in this view, comes from treating everything as equally important, which produces interfaces and documents where the essential is lost in the incidental.
An analogy is the upkeep of an old house. An owner who makes every repair with whatever is to hand, patching rather than fixing, will in twenty years have a house full of odd fixtures that nobody understands. An owner who, at each repair, also corrects whatever small problem made the repair necessary will have a house that ages well. The second owner does not rebuild the house; they simply refuse to make it worse.
This idea is often confused with refactoring as a separate activity, scheduled in its own time. Ousterhout's view is that design improvement should be woven into ordinary changes rather than postponed to a cleanup phase that may never come. Where it leads is to codebases that remain workable for many years, because every change has been an opportunity to improve them rather than a step toward decay.
The tradition around it
A Philosophy of Software Design stands in a long tradition of writing about how to structure programs. Its deepest root is the work of David Parnas on information hiding and modular decomposition in the early 1970s, which Ousterhout acknowledges directly. Behind that lies the structured programming movement and the broader conviction, shared by Dijkstra, Hoare, Wirth and others, that the main limit on software is human understanding. Fred Brooks's distinction between essential and accidental complexity is a near relative of Ousterhout's focus on complexity, though Ousterhout's definition is more practical and less philosophical.
Within this bay, the book's most direct counterpart is Clean Code by Robert C. Martin. Both books care about readable, maintainable code, and they agree on much. But they disagree sharply on several points: the ideal length of methods, the value of comments, and the role of test-driven development. Reading the two together is one of the best exercises a programmer can do, because each argues its case with conviction and the disagreement reveals real trade-offs. The Elements of Programming Style by Kernighan and Plauger is an earlier, more line-level guide to clarity, and many of its maxims about writing clearly and saying what you mean anticipate Ousterhout's chapters on names and obviousness.
Code Complete by Steve McConnell covers much of the same ground at far greater length and with more emphasis on construction practices; it, too, names complexity management as the primary technical imperative of software. Design Patterns by Gamma and colleagues offers reusable structures; Ousterhout's caution about patterns used without purpose is a useful counterweight. Refactoring by Martin Fowler supplies the techniques for improving design incrementally, which is the strategic programmer's daily work. Working Effectively with Legacy Code by Michael Feathers addresses what to do when tactical programming has already done its damage. The Pragmatic Programmer by Hunt and Thomas shares the book's concern with avoiding duplicated knowledge, which is closely related to information leakage.
Ousterhout's own design for Raft, and Kleppmann's account of consensus in Designing Data-Intensive Applications, show the same value of understandability applied to distributed algorithms. Site Reliability Engineering makes a related point about operations: its chapter on simplicity argues that every unnecessary line of code is a liability in production.
After 2018, the book became a common recommendation alongside or in place of Clean Code, and its vocabulary of deep and shallow modules, tactical programming and information leakage entered everyday discussion among engineers.
Questions and criticisms
The first criticism is that the book's examples are mostly small, drawn from student projects such as a text editor or a simple web server. Readers who work on very large systems, with many teams and long histories, sometimes find that the hardest design problems they face are organisational or architectural at a scale the book barely addresses. The principles still apply, but the book does not show them at work in a system of millions of lines.
A second criticism is that some of its key terms are hard to measure. Depth, obviousness and complexity are defined in terms of human understanding, which is the right definition but makes disagreement hard to settle. Two experienced engineers may look at the same module and disagree about whether it is deep. The red flags help, but they are symptoms, not tests.
A third concerns its positions on controversial topics. Advocates of test-driven development argue that Ousterhout misrepresents the practice, which they see as a design method that leads naturally to clean interfaces. Advocates of short methods argue that he underestimates the value of small, well-named functions for readability. Ousterhout's critics on comments argue that comments drift out of date and that effort spent on them would be better spent on clearer code. These are live debates, and the book is one side of them. A reader should treat its strong statements as positions to test, not rules to obey.
A fourth is that the book says little about some important topics, such as concurrency, distributed design, performance engineering at scale, data modelling and the influence of language features such as strong type systems on design. Its scope is deliberately narrow, focused on the structure of code within a single system.
Some readers have also noted that the book's examples lean toward object-oriented languages, and that functional programming traditions have their own approaches to managing complexity, through immutability and composition, which the book does not engage.
What has held up is substantial. The definition of complexity in terms of change amplification, cognitive load and unknown unknowns is clear and useful. The idea of deep modules gives programmers a concrete standard. The critique of excessive decomposition corrected a real excess in industry practice. The suggestion to define errors out of existence and to write comments first changes how many programmers work. And the plea for strategic programming remains as relevant as ever.
Why it is on this shelf
This book is on the shelf because it reduces a sprawling craft to one disciplined question: does this make things simpler or more complicated for the person who comes next? That question applies to code, but also to any structure people must live with, whether a procedure, an argument, a set of rules or an organisation.
It belongs here alongside the economics books because its treatment of complexity is a treatment of cost over time. Tactical and strategic programming are a choice between consumption now and investment for later, and the book's argument that small, steady investment compounds is an economic argument. Its principle of pulling complexity downward, so that one implementer bears a cost that would otherwise fall on many users, is a recognisable argument about where costs should be borne.
It belongs near the books on science for its approach to explanation. Its insistence that an interface should describe what something does at the right level of abstraction, without forcing the reader into details, is the same discipline a good scientific explanation follows. Knowing what to leave out is half of understanding.
A reader of Vedanta may notice a resonance in the book's account of depth: a simple surface behind which a great deal is held, accessible without needing to be grasped in full. We note it lightly, as an echo rather than a claim.
Most of all it is here because it is short, clear and honest about where it takes sides. It models the virtue it recommends.
We also keep it because it is teachable. Its vocabulary of deep and shallow modules, leakage and red flags gives a group of people a shared way to talk about design, so that a review becomes a discussion of reasons rather than of taste. A book that improves conversations about work, and not only the work of one reader, earns its place on a shelf meant to be used.
How to read it
This is a book to read once in a few sittings and then keep within reach. Its chapters are short, and the whole can be read in a week at a relaxed pace.
On first reading, take the opening chapters on complexity and on strategic versus tactical programming together, in one sitting. They set the frame for everything else. Then read the chapters on deep modules, information hiding, general-purpose modules and layers of abstraction. These are the heart of the book. As you read, keep a codebase you know open beside you, and for each principle find one place where it is followed and one where it is violated.
Next read the chapter on errors and the chapter on designing it twice. Try the second immediately: take an interface you are about to write, or one you wrote recently, and sketch a radically different alternative. Compare them honestly.
Then read the chapters on comments, names and consistency. If you are sceptical about comments, as many readers are, read them closely and try the practice of writing interface comments before code for two weeks before deciding. With a pencil, write the interface comment for one module you know well and notice whether it is easy or hard to write.
The chapters on software trends and performance can be skimmed on first reading. Read them later, when you have absorbed the main principles, since they apply those principles to current practices.
Keep the summary of principles and the list of red flags at the end of the book near you when reviewing code. Use them as a checklist during reviews for a month; this is how the book becomes a habit rather than a memory.
From this shelf, read Clean Code next and compare the two on methods, comments and testing. Read Refactoring for the techniques that let you improve design steadily. Read Code Complete if you want a much fuller treatment of construction. Then read Designing Data-Intensive Applications and notice how often the deep-module idea describes the databases it explains.
Questions to carry
- Where in a system you know does a simple change require edits in many places?
- Which module do you have to understand fully before you can use it, and why?
- What change would you be afraid to make because you cannot tell what else it might break?
- Which design decisions in your code are known by more than one module?
- Was the last shortcut you took a reasonable trade, or the start of a slow decline?
- Which of your classes give a lot for a small interface, and which give little for a large one?
- Where does a method merely pass its arguments on to another method with the same signature?
- Which errors in your code could be defined out of existence by changing what an operation means?
- Which configuration options could a module decide for itself instead of asking its users?
- When did you last sketch a second design before building the first?
- Could you write a short, clear comment describing what this module does without saying how?
- Which names in your code would mislead a new reader?
- Where does the book's advice conflict with Clean Code, and which side does your own experience support?
Words to know
- Complexity: anything in the structure of a software system that makes it hard to understand and modify.
- Change amplification: a symptom of complexity in which a simple change requires modifications in many places.
- Cognitive load: how much a developer must know to complete a task.
- Unknown unknowns: a symptom of complexity in which it is not clear what must be changed or known to make a change correctly.
- Dependency: a relationship in which one piece of code cannot be understood or changed in isolation from another.
- Obscurity: important information that is not apparent to someone reading the code.
- Tactical programming: an approach focused on getting the current task working quickly, at the expense of design.
- Strategic programming: an approach that treats good design as the primary goal and invests steadily in it.
- Module: any unit of code with an interface and an implementation, such as a class, function or service.
- Interface: everything a user of a module must know to use it, including formal signatures and informal rules.
- Deep module: a module that provides much functionality behind a simple interface.
- Shallow module: a module whose interface is complicated relative to the functionality it provides.
- Classitis: the tendency to create many small classes in the belief that smaller is always better, producing many shallow modules.
- Information hiding: keeping a design decision inside one module so that other modules need not know it.
- Information leakage: a design decision reflected in more than one module, creating a dependency between them.
- Temporal decomposition: dividing a system according to the order in which operations occur, which often causes leakage.
- Pass-through method: a method that does little except call another method with a similar signature.
- Pulling complexity downward: absorbing complexity inside a module's implementation so that its users need not deal with it.
- Defining errors out of existence: designing an operation so that a condition which might have been an error becomes normal behaviour.
- Exception masking: handling an error at a low level so that higher levels never see it.
- Design it twice: the practice of sketching at least two different designs before choosing one.
- Interface comment: a comment describing what a module or method does and how to use it, without describing its implementation.
- Red flag: a symptom in code that suggests a design problem.
A note on this edition
This is a study edition written for the shelf in our own words. It describes and discusses A Philosophy of Software Design but does not reproduce it. Analogies and many examples here are our own; where the book's own examples are mentioned, they are described only in outline. The book itself is in copyright and is worth getting from a library or bookshop. It is short enough to read in a week and useful enough to keep for years.