Skip to content

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.

Taught in: PImpl, ABI, versioning, and compatibility

Related: PImpl (pointer to implementation), Interface (abstract class)

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.

Taught in: Abstract Factory

Related: Design pattern, Factory Method pattern, Factory function

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.

Taught in: Encapsulation and abstraction

Related: Encapsulation, Interface (abstract class)

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.

Taught in: Use cases, user stories, and acceptance criteria

Related: Use case, Functional requirement

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.

Taught in: Classes, objects, and access control

Related: Encapsulation, Invariant

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.

Taught in: Adapter

Related: Design pattern, Dependency inversion principle

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.

Taught in: What low-level design is (and is not)

Related: High-level design, 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.

Taught in: The delivery framework: approaching a design problem

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.

Taught in: Assumptions versus confirmed requirements

Related: Clarification question

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.

Taught in: Backpressure and bounded queues

Related: Cooperative cancellation, Data race

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.

Taught in: Bridge

Related: Design pattern, Abstraction, Composition

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.

Taught in: Builder

Related: Design pattern, Factory Method pattern, Invariant

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.

Taught in: Cache policies and invalidation

Related: Time to live, Proxy pattern

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.

Taught in: Performance: allocation, locality, and data layout

Related: Struct of arrays

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.

Taught in: Observability

Related: Observability

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.

Taught in: Chain of Responsibility

Related: Design pattern, Decorator pattern

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.

Taught in: Refactoring toward principles

Related: Refactoring, Test double, Golden master

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.

Taught in: From vague statements to clarification questions

Related: Assumption, Stakeholder

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.

Taught in: Cohesion and coupling

Related: Coupling, Responsibility

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.

Taught in: Command

Related: Design pattern, Strategy pattern

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.

Taught in: Designing member functions in C++

Related: Const correctness

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.

Taught in: Composite

Related: Design pattern, Composition, Ownership

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.

Taught in: Composition over inheritance, and programming to interfaces

Related: Interface (abstract class), Polymorphism, Variation point

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.

Taught in: Dependency direction and dependency injection

Related: Dependency injection

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.

Taught in: const correctness

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.

Taught in: Functional and non-functional requirements

Related: Functional requirement, Non-functional requirement

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.

Taught in: Stakeholders, goals, scope, and exclusions

Related: Scope, Stakeholder

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).

Taught in: The Liskov Substitution Principle

Related: Invariant, Liskov substitution principle, Interface (abstract class)

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.

Taught in: Testing strategy: unit, integration, and contract tests

Related: Contract, Liskov substitution principle, Test double

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.

Taught in: Asynchronous work, cancellation, and shutdown

Related: Data race, RAII

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.

Taught in: Cohesion and coupling

Related: Cohesion, Dependency injection

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.

Taught in: References, pointers, and explicit ownership

Related: Lifetime, 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.

Taught in: Thread safety and synchronization

Related: Undefined behaviour, Race condition

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.

Taught in: Deadlocks and lock ordering

Related: Data race

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.

Taught in: Decorator

Related: Design pattern, Composition, Adapter pattern

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.

Taught in: Prototype

Related: Prototype pattern, Ownership

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.

Taught in: The delivery framework: approaching a design problem

Related: Artifact (design artifact)

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.

Taught in: Dependency direction and dependency injection

Related: Dependency inversion principle, Coupling

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.

Taught in: The Dependency Inversion Principle

Related: SOLID, Interface (abstract class), Dependency injection

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.

Taught in: Anti-patterns, design smells, and design debt

Related: Design smell, Refactoring

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.

Taught in: How to study design patterns

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.

Taught in: Anti-patterns, design smells, and design debt

Related: Design debt, Refactoring, God class

Domain model

The set of concepts, rules, and relationships of the problem area, expressed as types and functions in code.

Taught in: From domain concepts to code

Related: Entity, Value object

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.

Taught in: Visitor

Related: Visitor pattern

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.

Taught in: DRY, KISS, and YAGNI

Related: Wrong abstraction, YAGNI (You Aren't Gonna Need It), KISS (Keep It Simple)

E

Encapsulation

Keeping data and the rules that protect it together, and allowing changes only through operations that keep the object valid.

Taught in: Encapsulation and abstraction

Related: Abstraction, Invariant

Entity

A domain object with an identity that stays the same while its attributes change, such as an order with an order number.

Taught in: Entities, value objects, and services

Related: Value object, Domain model

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".

Taught in: Identity and equality

Related: Entity, Value object

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.

Taught in: Idempotency, retries, and duplicate handling

Related: Idempotency, Backpressure

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.

Taught in: Facade

Related: Design pattern, God class, Mediator pattern

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.

Taught in: Factory Method

Related: Factory Method pattern, std::unique_ptr

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.

Taught in: Factory Method

Related: Design pattern, Factory function, Template Method pattern

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.

Taught in: Invariants and failure scenarios

Related: Invariant, Use case

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.

Taught in: Testing concurrent code and its limits

Related: Stress test, Race condition

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.

Taught in: Flyweight

Related: Design pattern, Proxy pattern

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.

Taught in: Template Method

Related: Template Method pattern

Functional requirement

A statement of what the system must do, such as "a member can reserve an available book".

Taught in: Functional and non-functional requirements

Related: Non-functional requirement, Acceptance criterion

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.

Taught in: Finding classes, data members, and member functions

Related: Cohesion, Responsibility

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.

Taught in: Refactoring safely in small steps

Related: Characterization test, Refactoring

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.

Taught in: What low-level design is (and is not)

Related: Application architecture, Low-level design

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.

Taught in: Idempotency, retries, and duplicate handling

Related: Failure scenario

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.

Taught in: Encapsulation and abstraction

Related: Encapsulation, Abstraction

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.

Taught in: Inheritance, virtual functions, and interfaces

Related: Polymorphism, Virtual destructor

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.

Taught in: The Interface Segregation Principle

Related: SOLID, Interface (abstract class), Liskov substitution principle, Cohesion

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.

Taught in: Interpreter

Related: Design pattern, Composite pattern

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.

Taught in: Invariants and encapsulation

Related: Encapsulation

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.

Taught in: Iterator

Related: Design pattern, Composite pattern

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.

Taught in: DRY, KISS, and YAGNI

Related: YAGNI (You Aren't Gonna Need It), DRY (Don't Repeat Yourself)

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.

Taught in: The Law of Demeter

Related: Tell, don't ask, Coupling, Encapsulation

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.

Taught in: Encapsulation and abstraction

Related: Abstraction, Encapsulation

Lifetime

The period during which an object exists and may be used: from the end of its construction to the start of its destruction.

Taught in: Constructors, destructors, and object lifetime

Related: Ownership, RAII, Dangling reference or pointer

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.

Taught in: The Liskov Substitution Principle

Related: SOLID, Contract, Invariant, Polymorphism

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.

Taught in: What low-level design is (and is not)

Related: High-level design, Application architecture

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.

Taught in: Mediator

Related: Design pattern, Observer pattern, 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.

Taught in: Memento

Related: Design pattern, Command pattern, Encapsulation

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.

Taught in: Copy and move semantics

Related: Rule of five, std::unique_ptr

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.

Taught in: Functional and non-functional requirements

Related: Functional requirement

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.

Taught in: Template Method

Related: Template Method pattern

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.

Taught in: Inheritance, virtual functions, and interfaces

Related: Polymorphism

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.

Taught in: Observability

Related: Cardinality (of a metric), Dependency injection, Composition root, Test double

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.

Taught in: Observer

Related: Design pattern, RAII, std::weak_ptr

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.

Taught in: The Open/Closed Principle

Related: SOLID, Variation point, Interface (abstract class), YAGNI (You Aren't Gonna Need It)

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.

Taught in: Quality constraints: scale, consistency, concurrency, latency, security, reliability

Related: Non-functional requirement, Assumption

Ownership

Responsibility for ending an object’s lifetime and releasing its resources. Every resource should have a clear owner; other code only observes it.

Taught in: References, pointers, and explicit ownership

Related: Lifetime, RAII, std::unique_ptr, std::shared_ptr

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.

Taught in: PImpl, ABI, versioning, and compatibility

Related: ABI (application binary interface), Encapsulation, Bridge pattern, std::unique_ptr

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.

Taught in: Generic programming: templates, concepts, and policies

Related: Strategy pattern, Polymorphism, Variation point

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.

Taught in: Templates: run-time versus compile-time polymorphism

Related: Interface (abstract class), Object slicing

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.

Taught in: Property-based and table-driven tests

Related: Invariant, Contract test

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.

Taught in: Prototype

Related: Deep copy, Object slicing, Design pattern

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.

Taught in: Proxy

Related: Design pattern, Decorator pattern, Interface (abstract class)

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.

Taught in: Thread safety and synchronization

Related: Data race, Invariant

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.

Taught in: RAII and resource management

Related: Ownership, Lifetime

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.

Taught in: Refactoring toward principles

Related: Characterization test, Single responsibility principle, Separation of concerns

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.

Taught in: Objects, responsibilities, and collaborations

Related: Cohesion

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.

Taught in: The Rule of Zero and the Rule of Five

Related: Rule of zero, Move semantics

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.

Taught in: The Rule of Zero and the Rule of Five

Related: Rule of five, RAII

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.

Taught in: Stakeholders, goals, scope, and exclusions

Related: Scope creep, Context diagram

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.

Taught in: Stakeholders, goals, scope, and exclusions

Related: Scope

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).

Taught in: Test doubles, seams, and designing for testability

Related: Test double, Dependency injection

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.

Taught in: Separation of concerns

Related: Cohesion, Coupling

Shared mutable state (also: global mutable state)

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.

Taught in: When patterns hurt

Related: Singleton pattern, std::shared_ptr

std::shared_ptr (also: shared_ptr, shared pointer)

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.

Taught in: Smart pointers: unique_ptr, shared_ptr, weak_ptr

Related: std::unique_ptr, std::weak_ptr, Ownership

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.

Taught in: The Single Responsibility Principle

Related: SOLID, Cohesion, Separation of concerns

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.

Taught in: Singleton (and why to avoid it)

Related: Composition root, Dependency injection, Design pattern

SOLID

Five design principles: single responsibility, open/closed, Liskov substitution, interface segregation, and dependency inversion. They are guidelines with costs, not laws.

Taught in: The Single Responsibility Principle

Related: Dependency inversion principle

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.

Taught in: The cost of unnecessary abstraction

Related: YAGNI (You Aren't Gonna Need It), KISS (Keep It Simple), Abstraction, Wrong abstraction

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.

Taught in: Stakeholders, goals, scope, and exclusions

Related: Scope, Clarification question

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.

Taught in: State

Related: Design pattern, Strategy pattern

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.

Taught in: Strategy

Related: Design pattern, Template Method pattern

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.

Taught in: Testing concurrent code and its limits

Related: Data race, Race condition, Flaky test

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.

Taught in: Performance: allocation, locality, and data layout

Related: Cache locality, Invariant

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.

Taught in: Finding classes, data members, and member functions

Related: Encapsulation, Responsibility

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.

Taught in: Template Method

Related: Design pattern, Non-virtual interface (NVI), Strategy pattern

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.

Taught in: Dependency direction and dependency injection

Related: Dependency injection, Seam

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.

Taught in: Cache policies and invalidation

Related: Cache invalidation

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.

Taught in: Traceability: requirement → design → test

Related: Acceptance criterion, Functional requirement

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.

Taught in: Security-sensitive boundaries

Related: Observability, Composition root

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.

Taught in: Type erasure

Related: Polymorphism, Value semantics, Adapter pattern, Interface (abstract class)

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.

Taught in: Constructors, destructors, and object lifetime

Related: Dangling reference or pointer, Data race

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.

Taught in: Smart pointers: unique_ptr, shared_ptr, weak_ptr

Related: std::shared_ptr, Ownership, RAII

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.

Taught in: Use cases, user stories, and acceptance criteria

Related: Acceptance criterion, Functional requirement

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.

Taught in: Use cases, user stories, and acceptance criteria

Related: Use case, Acceptance criterion

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.

Taught in: Entities, value objects, and services

Related: Entity, Equality operator (operator==)

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.

Taught in: Value and reference semantics

Related: Object slicing, Value object

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.

Taught in: Composition over inheritance, and programming to interfaces

Related: Interface (abstract class), Composition

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.

Taught in: Inheritance, virtual functions, and interfaces

Related: Interface (abstract class), 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.

Taught in: Visitor

Related: Design pattern, Composite pattern, double dispatch

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.

Taught in: Smart pointers: unique_ptr, shared_ptr, weak_ptr

Related: std::shared_ptr

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.

Taught in: DRY, KISS, and YAGNI

Related: DRY (Don't Repeat Yourself)

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.

Taught in: DRY, KISS, and YAGNI

Related: KISS (Keep It Simple), DRY (Don't Repeat Yourself)