
Explore how object oriented design patterns organize proven solutions to real-world problems, enabling cleaner, maintainable code and effective teamwork by leveraging inheritance, polymorphism, and encapsulation.
Explore the core concepts of object oriented programming, including classes, objects, attributes, and methods, and learn how encapsulation, inheritance, abstract classes, and interfaces shape reusable, modular designs.
Explore the solid principles of object-oriented design—single responsibility, open-closed, Liskov substitution principle, interface segregation principle, and dependency inversion—through code examples and practical analogies.
Explore the facade pattern in object oriented design patterns, with Java examples, showing a single interface that coordinates subsystems like smart home devices and file operations.
Explore the strategy pattern by implementing interchangeable payment strategies, such as credit card and PayPal, within a shopping cart context, and see how strategies switch and align with open-closed principle.
Explore the template method pattern by enforcing a fixed step order via an abstract class, with tea, coffee, and json/csv data processors that customize specific steps.
Understand the singleton pattern, which ensures one instance via a private constructor, a static instance field, and a GetInstance method, used to share theme color across UI elements.
Learn the state pattern, where each state is an object with open and close methods, demonstrated on a door and a video player, transitions replace conditionals.
Explore the adapter pattern that lets old message sender classes work with modern interfaces by converting inputs through an adapter, including usb, hdmi, and vga.
Discover how the bridge pattern separates abstraction and implementation to enable independent diversification of remotes, devices, and messages.
The factory method pattern uses an intermediary factory to create instances, decoupling client code from concrete classes like car and motorcycle. It enables changes in creation without touching client code.
Demonstrate the proxy pattern by using a proxy to lazily load heavy objects and enforce security criteria. See real image and bank account examples, with access control for withdrawals.
Explore the observer pattern, a one-to-many relationship where a subject notifies observers on state changes, with add/remove observers and update methods enabling loose coupling, flexibility, and scalability.
The flyweight pattern saves memory by sharing a single instance for identical data, using a hashmap to reuse books by title and fonts by a font-size-color key.
Explore the mediator pattern, introducing a central mediator that coordinates communication to reduce object coupling, demonstrated via a chatroom and an airport control tower example.
Explore the abstract factory pattern, producing families of related UI elements like buttons and checkboxes across Windows and Mac. See interfaces, platform factories, and a client painting the product line.
Explore the visitor pattern to add new features without modifying existing classes, and apply visitors to shapes and file systems to compute areas, perimeters, and total sizes.
Explore the builder pattern, which divides object creation into flexible steps and uses inner builder classes and method chaining to assemble complex objects like pizzas or http requests.
Explore the decorator pattern to dynamically add features to objects by layering decorators, illustrated with coffee and text styling examples.
The command pattern turns operations into objects, enabling execution, undo, and redo via an invoker, with a light as receiver and concrete on/off commands.
Explore the memento pattern, saving and restoring an object's internal state as snapshots through originator, memento, and caretaker, with examples from game saves and editor undo.
Explore the prototype pattern by cloning a prebuilt object to avoid heavy creation costs, duplicating templates and documents through a clone method and a prototype interface.
Apply the chain of responsibility pattern to pass a request along a chain of eligible objects, where each object processes the input and links a successor.
Explore the composite pattern, modeling part-whole hierarchies with leaves and composites in a tree structure, using file systems and UI components to add, remove, and render elements.
Explore the interpreter pattern by parsing expressions and evaluating them with an interpret method, including numeric, add, and subtract expressions, and applying sql-like select with where.
Explore the publisher-subscriber pattern with a broker that decouples publishers from subscribers, enabling topic-based subscriptions, asynchronous messaging, and scalable, event-driven communication.
Explore the iterator pattern by implementing simple iterators over lists and complex structures like a file system, using hasnext and next to traverse depth first and breadth first orders.
Discover how the specification pattern lets you build reusable, composable rules to test objects against conditions, combine them with and/or/not, and filter products by category, price, and stock.
You've probably seen self-defense or Jiu-Jitsu technique demonstration videos on YouTube.
By carefully observing Jiu-Jitsu content, you can learn how to subdue an opponent or defend yourself by leveraging various aspects of the human body, like joints, the principle of leverage, and the center of gravity. Watching these techniques, which utilize the structure and mechanics of the body, you might think, "I've used my body all my life, but I never realized it could do this."
While not as intricate as the human body, object-oriented programming languages provide complex features beyond simply using classes and objects. Concepts like inheritance, polymorphism, and encapsulation are often challenging to apply effectively in practice. As a result, many people end up using object-oriented languages, like Java, in a procedural manner, simply because they don’t know how to make full use of these features.
By learning object-oriented design patterns, you’ll discover how to utilize the complex features of object-oriented languages effectively in real-world scenarios. Design patterns offer ways to solve complex problems more easily and make coding and maintenance much simpler. Just as learning techniques in Jiu-Jitsu enables you to use them as needed, learning design patterns helps you apply object-oriented features more effectively in practical situations.