Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
18 Cards in this Set
- Front
- Back
Design Pattern: Flyweight |
-used to reduce the memory and resource usage for complex applications containing many hundreds, thousands, or millions of duplicate objects
-only one object holding a specific value is ever created (immutable objects) |
|
Pros of Flyweight |
-reduce resource load
-easy to make an efficient API
|
|
Cons of Flyweight |
-Only optimizes code, should not be used everywhere
-Adds complexity to code, harder to maintain and debug |
|
Design Pattern: Memento |
-Permits the current state of an object to be "externally" stored without breaking the rules of Encapsulation or the SRP principle
-Domain object can be modified but can be restored to the saved state at any time
-Supports an "undo" option! |
|
Operation Reversal |
Storing a list of executed operations, each associated with a reverse operation |
|
State Storage |
Storing the state of something after each "move"
Used in checkers or chess, too complex for operation reversal. |
|
Memento Components |
Originator - domain object w/ internal state
Caretaker - responsible for saving memento objects and returning them. caretaker doesn't know what's inside the mementos.
Memento - used to hold information from an originator's state. a snapshot! |
|
Design Pattern: Composite |
-partitioning design pattern
-allows a group of objects to be treated the same way as a single instance of an object
-composes objects into structures that represent part-whole hierarchies. composite lets objects treat individual objects and compositions uniformly |
|
Single Responsibility Principle |
-there should never be more than one reason for a class to change
-having more than one responsibility couples the responsibilities :\ |
|
Open-Closed Principle |
-open for extension and closed for modification
-don't change old code but free to add new code |
|
Liskov Substitution Principle |
-Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it
-if a program module is using the reference of a Base class, then it should be able to replace the Base class with a Derived class without affecting the functionality of the program |
|
Dependency Inversion Principle |
-high-level modules should not depend upon low-level modules. both should depend upon abstractions
-abstractions should not depend upon details. details should depend upon abstractions.
|
|
Interface Segregation Principle |
- Clients should not be forced to depend upon interfaces they do not use |
|
Design Pattern: NullObject |
An object with a defined null behavior.
Used to handle situations where a behavior is absent. |
|
Design Pattern: Monostate |
"Conceptual Singleton"
Multiple instances can be created, instances of variables are static. You can create a thousand instances of the class, but they will see and share the same values. |
|
Design Pattern: PowerType |
Removing unchanging "type" data from classes representing individual objects.
This pattern splits the "TheClass" into 2 classes. "TheClass" with changing data and "TheClassType" with unchanging data |
|
Design Pattern: Observer |
Allows one object (or more) to watch another (the subject). Publish-Subscribe relationship.
Behavioral design pattern. |
|
Design Pattern: Decorator |
A pattern that allows behavior to be added to an individual object either statically or dynamically without affecting the behavior of other objects from the same class.
Employee investigator01 = new PrincipleInvestigator(); |