Glossary
Short definitions of the terms used across the site. Each lesson links a term to its entry here the first time it uses it. Where a lesson that teaches the term in depth is published, the entry links to it.
A
- ABI (application binary interface) (also: application binary interface, binary compatibility)
The agreement, below the level of source code, between a compiled program and a library it uses: the sizes and layouts of types, the order of virtual functions, how arguments are passed, and the mangled names of functions. A library change that keeps its ABI lets old programs run with the new library without being rebuilt.
- Abstract Factory pattern (also: abstract factory, kit)
A design pattern in which a client gets several kinds of related object from one factory object, with one creation function per kind. Each concrete factory creates one family of products, so a client that uses one factory cannot mix families.
- Abstraction
Describing something by what it does for its users while hiding how it does it. A good abstraction lets callers ignore details that do not affect them.
- Acceptance criterion
A concrete, checkable condition that must hold for a requirement or use case to count as satisfied. Good criteria can be turned directly into tests.
- Access control (public, private, protected)
C++ rules that say which code may name a class member. Public members are usable by any code, private members only by the class itself (and its friends), and protected members also by derived classes. Access is checked by the compiler, per class, not per object.
- Adapter pattern (also: adapter, wrapper)
A design pattern in which a small class implements the interface its callers expect and, inside each function, calls an existing class with a different interface, translating arguments and results. Often used at system boundaries to keep a vendor library's terms out of the rest of the program.
- Application architecture
How one application is divided into large parts (layers, modules, components) and the rules about which part may depend on which. It sits between high-level design and low-level design.
- Artifact (design artifact)
Something a design step produces that can be written down and checked, such as a list of clarification questions, a requirement, a diagram, or a test.
- Assumption
An answer that a design is working with but that nobody with the authority to decide has confirmed. Assumptions are labelled so they can be checked before they shape too much of the design.
B
- Backpressure (also: bounded queue)
Making the fact that a consumer has fallen behind reach the producers, so that they wait, are refused, or lose items on purpose instead of filling memory. A bounded queue gives backpressure by saying what push does when the queue is full.
- Bridge pattern (also: bridge)
A design pattern for a design that varies in two independent ways: it splits the classes into two hierarchies, an abstraction and an implementation, and the abstraction uses the implementation only through one interface of low-level operations. Either side can then grow without one class per combination.
- Builder pattern (also: builder, fluent builder)
A design pattern in which a separate builder object collects the parts of a complex object through named steps, in any order, and a final build() checks them together and creates the finished object, so the object is valid from the moment it exists.
C
- Cache invalidation (also: invalidation, stale data)
Whatever makes a cache stop serving a copy that no longer matches the source: a time to live, removing the copy when the data is written, a change notification, or a key that includes a version. A copy served after the source changed is stale data.
- Cache locality (also: locality, memory locality)
How well a program uses the processor caches: whether it uses most of each cache line it fetches from memory, and reads memory in an order the processor can predict. A vector walked from front to back has good locality; objects reached through a pointer each have poor locality.
- Cardinality (of a metric) (also: label cardinality, high cardinality)
The number of different series a metric has: one for each combination of its label values. A label with a closed set of values, such as an outcome, keeps it small; a label taken from input, such as a request ID or a user-supplied name, can create series without limit and exhaust memory.
- Chain of Responsibility pattern (also: chain of responsibility, handler chain, successor)
A design pattern in which a request is passed along a sequence of handlers until one of them deals with it. Each handler decides on its own whether to take the request or pass it to the next; the sender sees only the start of the chain and does not know which handler will answer.
- Characterization test (also: golden test, pinning test)
A test that records what existing code does today, right or wrong, so that a refactoring can prove it changed nothing. It describes current behaviour rather than a requirement.
- Clarification question
A question asked about a gap or ambiguity in a request before designing, so that the gap becomes a confirmed decision rather than an accident in the code. The most important ones are those whose different answers lead to different designs.
- Cohesion
How closely the responsibilities inside one class or module belong together. High cohesion means a unit has one clear purpose and changes for one kind of reason.
- Command pattern (also: command)
A design pattern that turns each request into an object holding what it needs to run and, when needed, to be reversed, so the code that runs requests can keep, list, group, queue, or undo them without knowing what they do.
- Command-query separation (also: CQS, commands and queries)
Keeping functions that change an object (commands) apart from functions that only report on it (queries), so that asking a question never changes the answer. In C++, queries are usually const member functions.
- Composite pattern (also: composite)
A design pattern that arranges objects in a tree of parts and wholes and gives single objects (leaves) and groups of objects (composites) the same interface, so that code can use a part or a whole the same way. A composite answers an operation by applying it to each of its children.
- Composition
Building an object's behaviour from other objects it holds or is given, which can be swapped or combined, instead of from a base class it inherits implementation from.
- Composition root
The one place in a program (often main) that creates the real objects and connects them, so that every other class only receives the collaborators it needs.
- Const correctness (also: const)
Using const consistently so that the compiler enforces which functions and references may modify an object. A const member function promises not to change the observable state of the object.
- Constraint
A limit on the solution that is fixed from outside the design, such as a required platform, an existing system that must be used, or a law. Unlike a requirement, it does not describe behaviour; it narrows the choices for building it.
- Context diagram
A diagram that shows a system as one box, with the people and outside systems it exchanges information with around it. It shows where the system's boundary is.
- Contract (also: precondition, postcondition, design by contract)
What a function or class promises and what it requires: preconditions (what must be true before a call), postconditions (what is true after it, including which errors it may report), and invariants (what is always true of an object between calls).
- Contract test (also: interface test)
A set of checks written once for an interface and run against every implementation of it, so that each implementation is shown to keep the same promises. It finds the implementation that behaves differently, which tests that use only one implementation, or a test double, cannot.
- Cooperative cancellation (also: stop token)
Stopping work by asking it to stop and letting the running code check the request at points where stopping is safe. C++ offers no safe way to kill a thread, so std::stop_source requests a stop and the code holding a std::stop_token checks it.
- Coupling
How much one part of a program depends on the details of another. Loose coupling means a change in one unit rarely forces changes in others.
D
- Dangling reference or pointer (also: dangling pointer, use after free)
A reference or pointer that still refers to an object whose lifetime has ended. Using it is undefined behaviour.
- Data race
Two threads access the same memory location without synchronization, and at least one access is a write. In C++ a data race is undefined behaviour.
- Deadlock (also: lock-order inversion)
Two or more threads each wait for a lock that another of them holds, so none can ever continue. It needs mutual exclusion, hold and wait, no preemption, and circular wait all at once; taking locks together or in one fixed order prevents it.
- Decorator pattern (also: decorator)
A design pattern that adds behaviour to an object by wrapping it in another object with the same interface. The wrapper does its own step and passes each call on to the object it wraps, so wrappers can be stacked in any number and order without changing the wrapped class.
- Deep copy (also: shallow copy)
A copy that also copies every object the original owns, all the way down, so the copy and the original share nothing. A shallow copy copies only the pointers, so both end up pointing at the same parts.
- Delivery framework
A fixed order of five steps for presenting a design: requirements, entities and relationships, class design, implementation, and extensibility. Each step produces a short written output.
- Dependency injection
Giving an object the collaborators it needs (usually through its constructor) instead of letting it create or look them up itself. It makes dependencies visible and replaceable in tests.
- Dependency inversion principle (also: DIP)
High-level policy should not depend on low-level details; both should depend on abstractions that the high-level side owns. The D in SOLID.
- Design debt (also: technical debt)
A design shortcut, or a design that no longer fits, that makes later changes cost more. Like a loan, it can be taken on deliberately; fixing it costs the principal, and each change made in the meantime pays interest.
- Design pattern
A named, reusable solution shape for a recurring design problem, together with its trade-offs. A pattern is applied when the problem is present, not added for its own sake.
- Design smell (also: code smell)
A visible feature of code that often goes with a design problem, such as one change needing edits in many files. A smell is a reason to look closer, not proof that something is wrong.
- Domain model
The set of concepts, rules, and relationships of the problem area, expressed as types and functions in code.
- double dispatch
Choosing which code to run from the dynamic types of two objects rather than one. C++ virtual calls choose by one type only, so the Visitor pattern makes two calls: a virtual accept on the element, which then calls a virtual visit on the visitor with the element's exact type.
- DRY (Don't Repeat Yourself)
The rule that each piece of knowledge in a program (a business rule, a format, a constant) should have one home, so that a change to it is made in one place. It is about duplicated knowledge, not about similar-looking code.
E
- Encapsulation
Keeping data and the rules that protect it together, and allowing changes only through operations that keep the object valid.
- Entity
A domain object with an identity that stays the same while its attributes change, such as an order with an order number.
- Equality operator (operator==) (also: operator==)
The function that defines when two objects are equal. In C++20, operator== can be defaulted, and a != b is rewritten in terms of ==. For entities, equality usually means "same identity"; for value objects, "same values".
- Exponential backoff (also: backoff, jitter)
Waiting longer before each retry, typically doubling the wait each time up to a cap, so that a failing service is not hit again at once. Jitter makes each wait random, between zero and the limit, so that clients that failed together do not all retry at the same moment.
F
- Facade pattern (also: facade)
A design pattern in which one class gives a group of classes that must be used together a small interface for the jobs most callers need, and knows which of them to call in which order. The classes behind it stay usable directly, for callers that need finer control.
- Factory function (also: simple factory, creation function)
A function that creates an object whose concrete type it chooses, usually from a name or a setting, and returns it through a pointer to a base class, in modern C++ a std::unique_ptr. It puts the choice of class in one place; it is not itself one of the classic design patterns.
- Factory Method pattern (also: factory method)
A design pattern in which a base class does its work with an object it does not create itself: it calls a virtual function, the factory method, that each derived class overrides to create the right concrete type.
- Failure scenario
One specific way part of a system or an outside system can go wrong, such as a printer jamming part-way through a job, together with how it is detected, how it is handled, and what the user sees.
- Flaky test (also: flaky, intermittent test failure)
A test that sometimes passes and sometimes fails on the same code, usually because it depends on timing, the order threads run in, or other state it does not control. Rerunning it until it passes hides real bugs that fail the same way.
- Flyweight pattern (also: flyweight, intrinsic state, extrinsic state)
A design pattern that saves memory when very many objects repeat part of their state: the repeated part (intrinsic state) is held once in an immutable shared object, made by a factory, and the part that differs per use (extrinsic state) is kept by each user or passed in.
- Fragile base class
The problem that a change inside a base class, even one that keeps its declarations the same, can break derived classes, because they depend on how and when the base calls their overrides.
- Functional requirement
A statement of what the system must do, such as "a member can reserve an available book".
G
- God class (also: god object)
A class that holds most of a program's data and applies most of its rules, while the other classes are only bags of fields. Every new requirement changes it.
- Golden master (also: golden-master test, approval test, snapshot test)
A characterization test that runs code over many inputs, writes each result as a line of text, and compares the lines with a file recorded before a change. A difference names the inputs whose results changed. The recording is checked by reading it, and recorded again only for a deliberate change of behaviour, whose diff is reviewed.
H
- High-level design (also: system design)
Design of a whole system across processes and machines: services, data stores, networking, scaling, and deployment. Low-level design works inside one of those parts.
I
- Idempotency (also: idempotent)
The property of an operation that has the same effect whether it is applied once or several times. It matters wherever a message or request can arrive twice, for example after a network retry.
- Information hiding
Putting each design decision that is likely to change inside one module or class, so that changing the decision changes only that place. Encapsulation enforces it; abstraction is what other code sees instead.
- Interface (abstract class)
In C++, usually a class with only pure virtual functions and a virtual destructor. Callers depend on the interface; concrete classes implement it.
- Interface segregation principle (also: ISP, role interface, fat interface)
No client should be forced to depend on functions it does not use. Instead of one wide interface, give each kind of client a small role interface with what it needs; one class may implement several roles.
- Interpreter pattern (also: interpreter, abstract syntax tree, grammar, recursive descent)
A design pattern in which each rule of a small language is a class, so a sentence in the language becomes a tree of objects (an abstract syntax tree) that is evaluated by asking its root, which asks its children. Building the tree, for example by parsing text, is a separate step.
- Invariant
A condition that must be true for an object (or system) whenever it is observed from outside, for example "the balance is never negative". Constructors establish invariants and member functions preserve them.
- Iterator pattern (also: iterator, iterator invalidation, iterator category)
A design pattern in which a small object, the iterator, holds a position in a collection and knows how to read the element there and move to the next, so code can walk the collection without seeing how it is stored. In C++ the pattern is a set of conventions (begin, end, *, ++, ==) that the standard library, range-for, and algorithms rely on.
K
- KISS (Keep It Simple)
The rule to choose the design with the fewest moving parts and concepts that still meets the real requirements. It does not mean the fewest lines, or skipping tests and error handling.
L
- Law of Demeter (also: principle of least knowledge, train wreck)
A guideline about coupling: a function should call only itself, its parameters, objects it creates, and its own data members, not objects that those returned. Chains through plain values, fluent builders, and range pipelines are not a problem; reaching through an object to change another object's state is.
- Leaky abstraction
An abstraction whose callers must know something it was meant to hide, such as how data is stored, which hardware is used, or how slow a call is, in order to use it correctly.
- Lifetime
The period during which an object exists and may be used: from the end of its construction to the start of its destruction.
- Liskov substitution principle (also: LSP, substitutability)
Code that works with a base type must keep working, unchanged, when given any derived type. A derived class may not demand more of its callers (stronger preconditions), promise less (weaker postconditions), or break the base class's invariants.
- Low-level design (also: LLD, object-oriented design)
Design inside one program or component: the classes, interfaces, responsibilities, data structures, and interactions that implement the requirements, and the reasons for choosing them.
M
- Mediator pattern (also: mediator)
A design pattern in which a set of objects (colleagues) talk to one object that coordinates them, instead of holding links to each other, so the rules about who affects whom live in one place. A mediator that also does the colleagues' own work becomes a god class.
- Memento pattern (also: memento, snapshot, originator, caretaker)
A design pattern in which an object (the originator) saves its own state as an opaque value (the memento), which other code (the caretaker) keeps and later hands back so the object can restore that state. Only the originator can read what a memento contains, so saving and restoring do not expose its internals.
- Move semantics
Transferring the resources of an object that is no longer needed into another object instead of copying them. The moved-from object stays valid but its value is unspecified unless the type documents it.
N
- Non-functional requirement (also: quality attribute, NFR)
A requirement about how well the system must work rather than what it does: for example latency, reliability, security, or maintainability.
- Non-virtual interface (NVI) (also: NVI, non-virtual interface idiom)
A C++ idiom: a class exposes public non-virtual functions that call private (or protected) virtual ones, so the base class controls what happens around every customisable step and callers cannot bypass it.
O
- Object slicing (also: slicing)
Copying a derived-class object into a base-class object by value, which keeps only the base part. The derived data and overridden behaviour are lost.
- Observability (also: telemetry, logs, metrics, and traces)
How well a running program can be understood from the outside, from what it records: structured log lines about individual events, metrics that count and time things cheaply, and traces that follow one request through its steps. In a design, it is best reached through a port the core calls with events in its own words, so that the record format is an adapter decision.
- Observer pattern (also: observer, publish-subscribe)
A design pattern in which objects subscribe to an object that changes, through one small interface, so that it can tell all of them about each change without knowing what they are. In C++, each subscription is best held by an RAII handle that unsubscribes when it is destroyed.
- Open/closed principle (also: OCP, open for extension, closed for modification)
A module should be open for extension and closed for modification: a likely kind of change can be made by adding new code or data, without editing code that already works. It applies to the kinds of change you expect, not to every change.
- Order-of-magnitude estimate (also: back-of-the-envelope estimate)
A rough calculation, from a few stated numbers and assumptions, of whether a quantity such as load, memory, or storage is closer to tens, thousands, or millions. It is usually enough to choose a design and to rule out designs the numbers do not need.
- Ownership
Responsibility for ending an object’s lifetime and releasing its resources. Every resource should have a clear owner; other code only observes it.
P
- PImpl (pointer to implementation) (also: pointer to implementation, compilation firewall)
A C++ idiom in which a class holds only a pointer to a private implementation struct that its header declares but does not define. Users cannot see or depend on the hidden fields, so they can change without recompiling users or, in a shared library, without breaking its ABI.
- Policy-based design (also: policy, policy class)
Building a class template from several independent choices, each supplied as a template argument called a policy, such as how a logger formats a line and where it writes it. The choices are fixed when the program is compiled, so there are no virtual calls, but each combination is a separate type.
- Polymorphism
Using one interface for different types. Dynamic polymorphism chooses the implementation at run time through virtual functions; static polymorphism chooses it at compile time through templates.
- Property-based test (also: property test, property-based testing, shrinking)
A test that states something that must be true for every valid input, such as "the parts add up to the total", and checks it on many generated inputs instead of a few hand-picked ones. The inputs usually come from a fixed seed so a failure can be repeated, and a failing input is shrunk to a simpler one that still fails.
- Prototype pattern (also: Prototype, virtual clone)
A creational design pattern that makes new objects by copying a configured object, through a virtual clone() member function, so code that knows the object only through a base class can still make an exact, independent copy.
- Proxy pattern (also: proxy, virtual proxy, protection proxy)
A design pattern in which a stand-in object with the same interface as a real object controls access to it: for example by creating it only when it is first needed, checking whether the caller may use it, keeping results, or reaching it in another process. Clients cannot tell the proxy from the real object.
R
- Race condition (also: check then act)
A result that depends on how threads happen to interleave, such as a reader seeing two values at different moments, or a check whose answer is out of date by the time the action runs. It can happen even when every single access is safe, so it is not the same as a data race.
- RAII (also: resource acquisition is initialization)
Resource Acquisition Is Initialization: an object acquires a resource in its constructor and releases it in its destructor, so the resource is released on every path out of the scope, including exceptions.
- Refactoring
Changing the structure of code without changing what it does, in small steps that are each checked by tests. Adding a feature is a separate step that comes before or after, not during.
- Responsibility
Something a class knows or does on behalf of the rest of the program. Assigning responsibilities well is the core of object-oriented design.
- Rule of five
If a class needs a user-defined destructor, copy constructor, copy assignment, move constructor, or move assignment, it usually needs to define or delete all five.
- Rule of zero
Prefer classes that need none of the five special member functions, because their members (such as std::vector or std::unique_ptr) already manage resources correctly.
S
- Scope
What a system does and, just as important, what it deliberately does not do. A scope statement lists what is in and an explicit set of exclusions, each with a reason.
- Scope creep
The gradual growth of a system's scope through small additions that nobody decided as a whole, often adding features that serve none of the system's goals.
- Seam (also: link seam, interface seam, template seam)
A place where the behaviour of code can be changed without editing that code, so a test can put a double there. In C++ the common seams are an interface (a virtual function), a template or function parameter, and the link step (choosing which definition of a function is linked in).
- Separation of concerns
Giving each concern (one kind of question the code answers, such as reading input, applying a business rule, formatting output, or ordering the steps) its own function, file, or class, so that a change to one concern touches only that place.
Data that several parts of a program can both reach and change, such as a global, a singleton, or an object held through several non-const shared pointers. Results then depend on what other code did to it, tests affect each other, and threads need locks to use it safely.
A smart pointer for shared ownership: the object is destroyed when the last shared_ptr to it is destroyed or reset. Use it only when ownership is genuinely shared.
- Single responsibility principle (also: SRP, reason to change, actor)
A class or module should have one reason to change, where a reason to change is an actor: a person or group who can ask for changes. Shared facts may serve many actors; each actor's rules belong in their own place.
- Singleton pattern (also: Singleton, Meyers singleton)
A creational design pattern that allows a class only one object and gives the whole program one global way to reach it. In C++ it is usually written with a function-local static. It hides dependencies and shares state between tests, so passing the object in is usually better.
- SOLID
Five design principles: single responsibility, open/closed, Liskov substitution, interface segregation, and dependency inversion. They are guidelines with costs, not laws.
- Speculative generality
Abstraction added for variation that does not exist yet: an interface with one implementation and no test double, a factory with one product, options nobody sets. It costs reading and change effort now for a future that may never come.
- Stakeholder
Anyone who uses a system, runs it, pays for it, is affected by it, or can decide something about it. Users are only one kind of stakeholder.
- State pattern
A design pattern in which an object delegates each event to an object (or value) representing its current stage in a lifecycle; each stage holds its own data and rules and decides which stage comes next.
- Strategy pattern (also: strategy)
A design pattern in which a class delegates one job that can be done in several ways to an object it holds through a common interface, so the way can be chosen, or changed, without editing the class.
- Stress test (also: stress testing)
A test that runs many threads doing many operations on shared code, often repeatedly, and checks what must be true however the threads were interleaved, such as every item arriving exactly once. It can find interleavings nobody thought of, but only those that happen to occur, and a failure may show up as a hang or a wrong count rather than a precise message.
- Struct of arrays (also: SoA, array of structs, AoS)
A data layout that stores each field of many objects in its own array, so a loop that uses a few fields reads only those arrays. Its opposite, an array of structs, stores whole objects one after another. Struct of arrays needs a class to keep the arrays the same length.
T
- Tell, don't ask (also: tell dont ask)
A design guideline: instead of asking an object for its data and deciding for it, tell the object what you want and let it apply its own rules. Queries are still fine when the caller only needs the answer for itself.
- Template Method pattern (also: template method)
A design pattern in which a base-class function fixes the steps of an algorithm and their order, and derived classes supply only the steps that differ. It has nothing to do with C++ templates.
- Test double (also: fake, spy, stub, mock)
An object that stands in for a real collaborator in a test. A fake is a simple working version (a clock that moves only when told); a spy records how it was used; a stub returns fixed answers; a mock checks expected calls.
- Time to live (also: TTL)
How long a cached copy may be served after it was stored. When a cache cannot hear about every change to its source, the time to live is the bound on how old an answer can be. Measure it with a steady clock.
- Traceability
Keeping links from each requirement to the design elements that implement it and the tests that check it, so that you can find untested requirements, code no requirement asks for, and the rework a change causes.
- Trust boundary (also: security boundary)
A place where data or control passes from a source that is trusted less, such as the network, a user, or a file others can write, to code that is trusted more. The code at the boundary must assume the input is hostile: it bounds every read, limits sizes before using them, accepts only what an allow-list permits, and fails closed; code behind it may then rely on what was checked.
- Type erasure (also: type-erased)
Hiding the concrete type of an object behind one ordinary type that offers a fixed set of operations, so that values of unrelated types can be stored and used together without a common base class. std::function is an example: it can hold any callable with the right signature. Inside, the wrapper usually holds a private interface and a template that adapts each stored type to it.
U
- Undefined behaviour (also: UB, undefined behavior)
An operation for which the C++ standard places no requirements on the result, such as reading a destroyed object or a data race. The program may appear to work, crash, or behave unpredictably.
- std::unique_ptr (also: unique_ptr, unique pointer)
A smart pointer that is the single owner of an object and deletes it when the unique_ptr is destroyed. It can be moved but not copied, which makes ownership transfer explicit.
- Use case
A description of how an actor uses the system to reach a goal, including the main steps and the alternative and failure paths.
- User story
A short statement of what someone needs and why, in the form "As a role, I want something, so that benefit". It is a placeholder for a conversation; its acceptance criteria make it precise.
V
- Value object
A domain object defined only by its values, with no identity of its own, such as an amount of money or a date range. Value objects are often immutable and compared by value.
- Value semantics
A type has value semantics when copying an object produces a new, independent object: changing the copy does not change the original. Most standard library types, such as std::string and std::vector, behave this way.
- Variation point
A place in a design where several behaviours must be supported and can change independently of the code that uses them, such as carriers that each price shipping differently. A difference in data alone is not a variation point.
- Virtual destructor
A destructor declared virtual in a base class, so that deleting a derived object through a base pointer runs the derived destructor. Without it, such a deletion is undefined behaviour.
- Visitor pattern (also: visitor, accept, visit)
A design pattern that puts each operation on a stable set of classes into a class of its own, the visitor, with one visit function per class. Each element has an accept function that calls the visitor's function for its own type. New operations need no change to the elements; a new kind of element changes every visitor, and the compiler finds each one.
W
- std::weak_ptr (also: weak_ptr)
A non-owning observer of an object managed by std::shared_ptr. It must be converted with lock() before use, which fails safely if the object is gone; it is used to break ownership cycles.
- Wrong abstraction
Shared code created by merging things that only looked alike, so that it couples rules with different owners and reasons to change. It usually grows flags or parameters for each caller, and is fixed by splitting it again.
Y
- YAGNI (You Aren't Gonna Need It)
The rule not to build features or extension points that no current requirement asks for. It does not excuse code that is hard to change; good structure is what keeps later features cheap.