Programming Bottom-Up

1993

(An opposing adaptation of the introduction to On Lisp.)

A program's functional components should be small enough to understand, test, and repair. But this principle applies to its abstractions as well as to its application routines. A short program written in a newly invented language can conceal as much complexity as a long one written conventionally. The question is how much a reader must understand to make a safe change, not how little source remains in the final file.

Top-down design begins by stating the program's responsibilities and dividing them into components with explicit relationships. It need not mean guessing every detail in advance or imposing a rigid tree that experience cannot alter. Its value is that it makes the overall obligations visible before local convenience determines the structure. Each part should have a clear purpose, inputs, outputs, and ownership. When implementation reveals a poor boundary, revise it deliberately. This preserves the original aim of manageable units while giving reviewers a way to reason about the whole. A component should become substantial enough to be useful and bounded enough that its behavior does not depend on understanding every other component.

Lisp permits another kind of growth: the programmer adds operators and lets the language and application evolve together. This can remove repetition, but it can also let local preferences become a private programming system before their consequences have been examined. An operator that simplifies one routine may hide a decision several other routines ought to expose. Reusing it then spreads that decision, making it look natural because the program has been reorganized around it. The eventual border between language and application is not necessarily the problem's natural frontier; it may record the order in which one author encountered difficulties. Before adding an operator, ask who will read it, how they will discover its meaning, and whether a conventional function with an explicit interface would preserve the same useful separation. The goal should be a design others can inspect independently of the inventor, rather than code that looks inevitable only after learning the inventor's vocabulary.

Building from the bottom up means that by the time you reach the top, the bottom has developed opinions. [see also: the opposite]

Bottom-up development changes the design, not merely the order of implementation. That is why it should be treated as an architectural choice. Replacing application code with a larger language moves obligations into that language: its semantics, error reporting, tools, and documentation. A smaller visible application does not prove the total system simpler, any more than hiding a machine's moving parts removes them.

Abstracting bookkeeping can be worthwhile. But the remaining application is only part of what must be maintained. Count the substrate, the learning it requires, and its interaction with ordinary tools. Four supposed advantages of bottom-up design deserve corresponding tests:

  1. Fewer visible components do not necessarily mean fewer opportunities for error. One general operator can connect many callers through a subtle rule, making a change unexpectedly broad. Ordinary functions with narrower responsibilities may require more source while preserving clearer failure boundaries. Measure agility by how safely someone can alter behavior, not by how many components disappeared. The industrial designer's reduction of moving parts is useful only when the surviving parts and their relationships remain inspectable; the same condition applies to a programming abstraction.

  2. Reuse is valuable when genuinely different applications need the same stable behavior. A growing substrate of utilities may instead accumulate assumptions from the first program and force later programs to accommodate them. Before promoting a convenience into infrastructure, use it in several contexts and identify what must stay invariant. A smaller shared interface can cost more initially and save more over its lifetime.

  3. Readability depends on shared meaning. A general-purpose operator may require more background than a direct, specific subroutine. The reader needs a route from the expression to its actual effects, not merely fewer expressions to read. [1]

  4. Searching for recurring patterns can expose a simpler design. It can also encourage premature unification of components that merely look alike. Check whether their responsibilities and likely changes are alike before making them depend on the same new language feature.

Libraries in other languages also build useful layers above primitive operations. Lisp's broader ability to reshape the language expands both the opportunity and the maintenance burden. A team should select the smallest departure from shared conventions that solves the problem, then document and test that boundary. The availability of a more powerful transformation is not itself a reason to make it part of every application's style.

Small groups can coordinate quickly, and Lisp's techniques may help such a group accomplish ambitious work. But Frederick Brooks's argument in The Mythical Man-Month about coordination costs does not establish the reverse proposition that shrinking a group always increases its effective capacity. A small group can also lack knowledge, review, or continuity. A private language may make its original authors faster while making every future contributor harder to add. The relevant comparison includes maintenance after the founding team changes. Stories of teams that won with Lisp should therefore prompt questions about their boundaries and practices, not a general prescription to maximize bottom-up invention. Design first for a system that can survive new readers; use language extension when it demonstrably improves that system.



New: Download On Lisp for Free.






[1] "But no one can read the program without understanding all your new utilities." That objection identifies a real learning cost. The original Section 4.8 answers it; evaluate that answer against the maintainers and tools of the particular project.