A to Z
Glossary
Every concept in this sheet, plus the smaller terms it uses. Select a concept to open its card.
A
- Abstraction
- Showing callers what something does and hiding how it does it.
C
- Class and object
- A class is a blueprint that bundles data (fields) with the behaviour that works on it (methods).
- Composition over inheritance
- Building a class by holding other objects and delegating to them (has-a) rather than by extending a parent (is-a).
D
- Dependency injection
- Passing an object the things it needs, usually through its constructor, instead of letting it create or look them up itself.
- Dependency inversion principle (DIP)
- High-level policy should not depend on low-level details; both should depend on an abstraction.
- DRY, KISS and YAGNI
- DRY: every piece of knowledge has one home.
E
- Encapsulation
- Hiding an object's internal state behind a small public interface, so outside code can only change it through methods that keep its rules (invariants) true.
I
- Inheritance
- A subclass takes on the fields and methods of a parent class and can add to or override them.
- Interface segregation principle (ISP)
- Clients should not be forced to depend on methods they do not use.
- Interfaces and abstract classes
- An interface lists methods a type promises to provide, with no state.
L
- Liskov substitution principle (LSP)
- A subtype must work anywhere its parent type is expected without surprising the caller: it may not demand more, promise less or throw where the parent would not.
O
- Open/closed principle (OCP)
- Code should be open for extension and closed for modification: you add behaviour by adding new code, such as a new class, rather than editing working code.
P
- Polymorphism
- One call working on many types: code asks any Shape for its area, and each type answers in its own way.
S
- Single responsibility principle (SRP)
- A class should have one reason to change, meaning it answers to one group of people or one kind of decision.
V
- Value objects and immutability
- A value object is defined by its values, not an identity: two Money(10, "USD") objects are equal.