Understand Object-Oriented Programming visually
Explore each concept's architecture through animated diagrams. Click a card to dive deeper.
Class
The basic design unit for objects
A class is the blueprint that declares the state slots and methods an object should have. Even when many objects exist at runtime, the class is what defines the structure and behavior they share.
Object
A concrete runtime instance
An object is the runtime instance created from a class. Even when two objects come from the same class, each can hold different state, and that state can change the result of the same method call.
Constructor
The routine that establishes initial object state
A constructor is the routine that runs when an object is being created and brings it into a usable starting state. It gathers the rules for which values are required and which invariants must hold from the very beginning.
Encapsulation
Protecting state behind controlled methods
Encapsulation is the principle of not exposing an object's internal state directly and instead forcing access through approved methods. The goal is not hiding for its own sake, but keeping the rules for state changes inside the object that owns them.
Abstraction
Modeling that keeps only the essential surface
Abstraction is the act of keeping the important properties of a problem and pushing distracting detail into the background. In object-oriented design, abstraction is less about simplification in the abstract and more about deciding which conceptual surface the rest of the system should see.
Interface
A contract that promises behavior without implementation
An interface is a contract that declares which operations must exist while leaving the implementation of those operations to concrete types. Callers can depend on the contract rather than on one class name and its internals.
Abstract Class
A base class with shared behavior and extension points
An abstract class is a base class that provides some shared implementation while still leaving some required behavior for subclasses to supply. Unlike an interface, it can carry reusable code and common state along with the contract.
Inheritance
A relationship that extends one type from another
Inheritance is the relationship where a new class is built on top of an existing class. The child class receives fields and methods from the parent and can add to them or override parts of them to become more specific.
Association
A link that expresses references between objects
Association means that one object knows about or references another object. In object-oriented modeling, it is the most basic way to describe not only isolated objects but also the relationship graph between them.
Composition
Building larger objects by combining smaller ones
Composition is the design style where one object owns or holds other objects as parts and delegates work to them to form the larger behavior. The important shift is that reuse happens through collaboration rather than through parent-child hierarchy.
Message Passing
How objects cooperate through method calls
Message passing is the idea that objects cooperate by sending requests to one another through method calls instead of reaching into each other's internals. The sender states what it wants; the receiver decides how to fulfill that request using its own state and implementation.
Polymorphism
The property that the same call can behave differently by type
Polymorphism is the property that callers can interact through one interface or base type while the actual behavior depends on the concrete runtime type. The caller does not need to know the class name to keep the collaboration working.