Explore tens of thousands of sets crafted by our community.
Design Patterns Overview
12
Flashcards
0/12
Singleton Pattern
The Singleton Pattern ensures a class has only one instance and provides a global point of access to it. Example use case: Logger classes that handle logging for an entire application.
Flyweight Pattern
The Flyweight Pattern uses sharing to support large numbers of fine-grained objects efficiently. Example use case: Text editors that use a character object instance for each character glyph that appears frequently in the document.
Prototype Pattern
The Prototype Pattern creates new objects by copying an existing object, known as the prototype. Example use case: Duplication in a graphic editor where the object's data is costly to recompute or requires a lot of configuration.
Abstract Factory Pattern
The Abstract Factory Pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes. Example use case: Cross-platform UI elements creation.
Composite Pattern
The Composite Pattern composes objects into tree structures to represent part-whole hierarchies, allowing clients to treat individual objects and compositions uniformly. Example use case: Graphic drawing applications that treat individual shapes and groups of shapes as objects that can be manipulated in the same way.
Facade Pattern
The Facade Pattern provides a unified interface to a set of interfaces in a subsystem, making the subsystem easier to use. Example use case: Simplifying client interaction with a complex multimedia library by providing a simple play/pause/stop interface.
Adapter Pattern
The Adapter Pattern allows incompatible interfaces to work together by converting the interface of one class into an interface expected by the clients. Example use case: Legacy code integration with new system interfaces.
Proxy Pattern
The Proxy Pattern provides a surrogate or placeholder for another object to control access to it. Example use case: Lazy-loading of heavy objects in a software application.
Factory Method Pattern
The Factory Method Pattern defines an interface for creating an object, but lets subclasses alter the type of objects that will be created. Example use case: Frameworks that allow overrides for component creation.
Builder Pattern
The Builder Pattern constructs a complex object step by step, allowing you to produce different types and representations of an object using the same construction process. Example use case: Building a complex meal from a menu of options.
Bridge Pattern
The Bridge Pattern separates an abstraction from its implementation so that the two can vary independently. Example use case: GUI frameworks that separate high-level window styles from low-level OS drawing operations.
Decorator Pattern
The Decorator Pattern attaches additional responsibilities to an object dynamically, providing a flexible alternative to subclassing for extending functionality. Example use case: Adding scrollbars to windows in a graphical user interface without altering the window's core code.
© Hypatia.Tech. 2024 All rights reserved.