OOP glossary

83 OOP terms, from Novice to Master. Start with the basics or jump to a level.

Updated

Novice

Behavior
What an object can do; the methods it offers.
Blueprint
The common analogy for a class: a plan used to build many objects.
Class
The template that describes what data and actions its objects will have.
Constructor
A special method that runs when an object is created and sets its starting values.
Instance
An object created from a class; each instance has its own data.
Method
A function that belongs to a class and describes something its objects can do.
Object
One specific thing in a program, with its own data and actions.
Object-Oriented Programming
A way of organizing code around objects that bundle data with the actions that use it.
Property
A piece of data that an object holds, such as a name or a price.
State
The current values of an object's data at a moment in time.

Apprentice

Abstract
A class or function that must be overridden.
Access Modifier
A keyword that defines what other code is allowed to see or execute this code.
Base Class
The class that other classes inherit from; it holds what they share.
Child Class
Another name for a derived class: a class that inherits from a parent class.
Derived Class
A class that inherits from another class and can add to it.
Encapsulation
Keeping an object's data private so it can only change through the object's own methods.
Getter
A method or property part that reads a value from an object.
Inheritance
Letting a class reuse and extend the data and methods of another class.
Instance Member
Data or a method that belongs to each individual object.
Method Overloading
Several methods with the same name but different parameters.
Method Overriding
A child class replacing an inherited method with its own version.
Object Identity
Every object is its own separate thing, even if its data matches another object.
Parent Class
Another name for a base class: the class a child class inherits from.
Polymorphism
Different objects responding to the same method call in their own way.
Private
An access level that hides the member from all code outside its own class.
Protected
An access level visible to the class itself and its child classes only.
Public
An access level that lets any code use the member.
Setter
A method or property part that changes a value, often checking it first.
Static Member
Data or a method that belongs to the class itself, shared by all objects.
this / self
The keyword a method uses to refer to the object it was called on.

Journeyman

Abstract Class
A class that cannot be created directly, but must be inherited.
Abstract Method
A method signature without a method body that must be overridden.
Aggregation
A loose "has-a" relationship where the parts can exist without the whole.
Association
Any relationship where one object knows about or uses another.
Big-O Notation
Big-O Notation refers to how complex code is.
Cohesion
How closely the things inside a class belong together; high cohesion is the goal.
Composition
Building an object out of other objects it owns ("has-a").
Composition over Inheritance
Advice to build behavior by combining objects instead of deep inheritance chains.
Coupling
How much one piece of code depends on another; loose coupling is the goal.
Dependency
Something a class needs in order to do its job, like a database or an email sender.
Downcasting
Treating a parent-typed variable as a specific child type; can fail, so check first.
Dynamic Dispatch
Choosing which version of a method to run based on the object's real type, at run time.
Immutable Object
An object whose data cannot change after it is created.
Interface
A list of methods a class promises to provide, with no code of its own.
Is-a vs Has-a
A quick test: "is-a" suggests inheritance, "has-a" suggests composition.
Mixin
A small reusable bundle of methods that can be added to unrelated classes.
Sealed / Final Class
A class that no other class is allowed to inherit from.
UML Class Diagram
A diagram of classes as boxes, with lines showing how they relate.
Upcasting
Treating an object as its parent type; always safe and automatic.
Value Object
An object defined only by its values; two with equal values are equal.
Virtual Method
A method that child classes are allowed to override.

Freelancer

Abstraction
Abstraction is the concept of focussing on only what is needed to solve the current…
Adapter Pattern
A pattern that makes one interface look like another, like a travel plug adapter.
Builder Pattern
A pattern for building a complicated object step by step.
Decorator Pattern
A pattern that wraps an object to add behavior without changing its class.
Dependency Injection
Handing a class the things it needs instead of letting it create them.
Dependency Inversion Principle
Depend on interfaces, not on specific implementations.
Design Pattern
A named, proven solution to a common code design problem.
DRY Principle
"Don't Repeat Yourself": keep each piece of knowledge in one place.
Factory Pattern
A pattern that puts object creation in one place so callers don't pick the class.
Interface Segregation Principle
Prefer small, focused interfaces so classes only provide what they need.
Law of Demeter
A method should talk to its direct collaborators, not reach deep into their parts.
Liskov Substitution Principle
A child class must work anywhere its parent class is expected, without surprises.
Observer Pattern
A pattern where subscribers are notified automatically when something changes.
Open/Closed Principle
Add new behavior by adding code, not by changing code that already works.
Repository Pattern
A pattern that hides data storage behind a simple collection-like interface.
Single Responsibility Principle
A class should have one job, and so only one reason to change.
Singleton Pattern
A pattern that allows only one object of a class for the whole program.
SOLID Principles
Five guidelines for keeping object-oriented code easy to change.
Strategy Pattern
A pattern where interchangeable classes each hold one way of doing a task.
Tell, Don't Ask
Tell an object what to do instead of pulling its data out and deciding for it.

Master

Aggregate Root
The single entry object for a group of related objects, guarding their rules.
Anemic Domain Model
Classes that hold only data while all the business rules live somewhere else.
Command Pattern
A pattern that turns an action into an object so it can be queued or undone.
Covariance and Contravariance
Rules for when a more specific or more general type can stand in for another.
Diamond Problem
The confusion when a class inherits the same method through two parents.
Domain-Driven Design
Designing code around the real business, its vocabulary and its rules.
Entity
An object defined by a lasting identity (an ID), not by its values.
Fragile Base Class Problem
When a change to a parent class unexpectedly breaks its child classes.
Inversion of Control Container
A framework tool that creates objects and supplies their dependencies automatically.
Object Pool
A set of ready-made objects that are reused instead of created fresh each time.
Template Method Pattern
A pattern where a base class fixes the steps and child classes fill some of them in.
Visitor Pattern
A pattern that adds new operations to classes by moving them into visitor classes.

More subjects in Programming Fundamentals