Skip to main content
Back to Tags

Object Oriented

45 items tagged with "object-oriented"

Filter by type:

Patterns32

Pattern

Factory Method

Defines an interface for creating an object but lets subclasses decide which concrete class to instantiate, deferring instantiation to subclasses.

Pattern

Abstract Factory

Provides an interface for creating families of related objects without specifying their concrete classes, ensuring products from one family are used together.

Pattern

Builder

Separates the construction of a complex object from its representation so the same construction process can create different representations step by step.

Pattern

Prototype

Creates new objects by cloning an existing instance (the prototype) rather than instantiating a class, useful when construction is costly or types are decided at runtime.

Pattern

Singleton

Ensures a class has only one instance and provides a global point of access to it, used for shared resources like configuration, logging, or connection pools.

Pattern

Multiton

Generalizes Singleton to manage a fixed, keyed set of named instances, ensuring exactly one instance exists per key through a registry.

Pattern

Registry

Provides a well-known central object where shared instances or services can be registered and looked up by key, giving a single point of access without scattered globals.

Pattern

Adapter

Converts the interface of a class into another interface clients expect, letting classes that could not otherwise collaborate work together.

Pattern

Bridge

Decouples an abstraction from its implementation so the two can vary independently, avoiding a combinatorial explosion of subclasses.

Pattern

Composite

Composes objects into tree structures to represent part-whole hierarchies, letting clients treat individual objects and compositions uniformly.

Pattern

Decorator

Attaches additional responsibilities to an object dynamically by wrapping it, providing a flexible alternative to subclassing for extending behavior.

Pattern

Flyweight

Minimizes memory use by sharing as much data as possible between many similar objects, separating intrinsic shared state from extrinsic context-specific state.

Pattern

Proxy

Provides a surrogate or placeholder for another object to control access to it, enabling lazy loading, access control, caching, or remote access.

Pattern

Marker Interface

Uses an empty interface to tag a class with metadata so other code can detect the capability at runtime via type checks, without adding any methods.

Pattern

Mixin

Composes reusable units of behavior into a class without inheritance, letting unrelated classes share functionality by mixing in shared method sets.

Pattern

Extension Object

Lets you add new interfaces and behavior to a class over time without changing it, by attaching extension objects that clients query for at runtime.

Pattern

Private Class Data

Restricts accessor-write access to class attributes by isolating data in a separate object exposed read-only after construction, enforcing immutability and encapsulation.

Pattern

Strategy

Defines a family of interchangeable algorithms behind a common interface so the algorithm can vary independently from the clients that use it.

Pattern

Observer

Establishes a one-to-many dependency so that when one object changes state, all its dependents are notified and updated automatically.

Pattern

Command

Encapsulates a request as an object, letting you parameterize, queue, log, and undo operations independently of who invokes them.

Pattern

Iterator

Provides a uniform way to traverse the elements of a collection sequentially without exposing its underlying representation.

Pattern

Mediator

Centralizes complex communication between objects in a mediator so components refer to it instead of to each other, reducing coupling.

Pattern

Memento

Captures and externalizes an object's internal state so it can be restored later without violating encapsulation.

Pattern

State

Lets an object alter its behavior when its internal state changes, appearing to change class by delegating to state-specific objects.

Pattern

Template Method

Defines the skeleton of an algorithm in a base method, deferring specific steps to subclasses so they can vary parts without changing the structure.

Pattern

Visitor

Separates an algorithm from the object structure it operates on, letting you add new operations over a class hierarchy without modifying it.

Pattern

Chain of Responsibility

Passes a request along a chain of handlers, each deciding to process it or forward it, decoupling sender from the specific receiver.

Pattern

Interpreter

Defines a grammar for a simple language and an interpreter that evaluates sentences in that language using a class per grammar rule.

Pattern

Null Object

Provides a do-nothing object with neutral behavior in place of null, eliminating null checks and special-case handling.

Pattern

Servant

Defines shared behavior for a group of classes in a separate servant object that operates on them, instead of duplicating the behavior in each class.

Pattern

Active Record

Wraps a database row in an object that carries both the data and the methods to load, save, and delete itself.

Pattern

Value Object

Models a concept defined by its attributes rather than identity, making it immutable and compared by value to keep the domain expressive and safe.

Anti-Patterns9

Anti-Pattern

Anemic Domain Model

Domain objects that hold data but no behavior, with all logic pushed into separate service classes, draining the object model of its purpose.

Anti-Pattern

Feature Envy

A method that is more interested in another class's data than its own, repeatedly reaching into that class instead of letting it own the behavior.

Anti-Pattern

Refused Bequest

A subclass that inherits methods or data it does not want or use, often overriding them to do nothing, signaling a wrong inheritance relationship.

Anti-Pattern

Yo-Yo Problem

An inheritance hierarchy so deep that understanding behavior forces constant scrolling up and down between many classes to trace a single call.

Anti-Pattern

Call Super

A framework requiring subclass overrides to call the parent method, a fragile contract that breaks silently whenever a developer forgets the call.

Anti-Pattern

Temporal Coupling

Methods that must be called in a specific hidden order, where calling them out of sequence silently breaks state with no compiler protection.

Anti-Pattern

Switch Statement Smell

Repeated switch or if-else chains branching on a type code, duplicated across the codebase, that should be replaced by polymorphism.

Anti-Pattern

Poltergeist

A short-lived, do-nothing class that only passes data or calls to other objects, adding indirection and noise without real responsibility.

Anti-Pattern

Sequential Coupling

A class designed so its methods must be invoked in a rigid sequence, with the ordering enforced only by convention rather than by the API itself.