51 cards
Design patterns are reusable solutions to problems that recur again and again in software design. Rather than being finished code that can be dropped into a project, patterns are templates or blueprints that describe how to solve a particular kind of problem, leaving the developer to adapt them to the surrounding conte...
Creational patterns focus on how objects are created, aiming to make instantiation flexible, decoupled, and appropriate to the situation. The Singleton pattern ensures that a class has only one instance and provides a global point of access to it. Typical implementations use a private constructor so clients cannot free...
Structural patterns describe how to assemble classes and objects into larger structures while keeping those structures flexible and efficient. The Adapter pattern converts the interface of a class into another interface that clients expect, allowing otherwise incompatible classes to work together. A common analogy is a...
Behavioral patterns are concerned with how objects communicate and how responsibilities are distributed among them. The Observer pattern defines a one-to-many dependency between objects so that when one object, the subject, changes state, all of its dependents, the observers, are notified automatically. This pattern sh...
The SOLID principles are five guidelines that help developers build object-oriented systems that are maintainable, flexible, testable, and resistant to gradual decay. The Single Responsibility Principle states that a class should have only one reason to change, meaning it should have just one job or responsibility. A c...
Several broader design principles complement the individual patterns and the SOLID guidelines. Composition over Inheritance favors assembling objects through has-a relationships rather than inheriting behavior through is-a ones. Composition avoids tight coupling to parent classes, allows behavior to be changed at runti...