Flashcards
ISD Final

Flashcards do conjunto (14)
- 1—Abstraction - Coordinates the interface, defines abstract base class (Expression_Tree)
Refined Abstraction - Extends the Abstraction for more functionality
Implementer - Used for Component_Node. Defines and outlines behavior for Concrete Implementors.
Concrete Implementor - Binary_Node, Unary_Node. Implements Implementor for a specific purpose
- 2Goal of patternsCodify Good Object Oriented Software designs and implementation practices
Distill and Generalize Experience
Aid Novices and experts alike
Give design structures explicit names - Common vocabulary, reduced complexity, greater expressivity
Facilitate restructuring/Refactoring - 3PatternMatch problem to design experience.
Abstract and name recurring design structure
(Name, problem, solution, consequences)
Language and implementation indpendent - 4Benefits/limitations of patternsBenefits: Design reuse, uniform design vocabulary, automation, abstract away from unimportant details
Limitations: Require significant tedious and error-prone human effort to implement, limit design options - 5AdapterConvert a class' interface into an interface expected by the clients, allowing classes that cannot otherwise work together due to incompatible interfaces work together
Applicable: Need to use existing class, but that one doesn't have a matching interface, Class should be reusable to cooperate with unrelated classes, Adapt interface from legacy container to interface the users want
typeid is dynamic, allows for polymorphism - 6AdapterClient - User calling the target
Target - The new interface
Adapter - Translates from target to the Adaptee
Adaptee - The existing legacy code
- 7ObserverDefine a one-to-many dependency between objects so that when one object changes state, all dependents are notified and updated.
Observers don't own data, but make use of it.
Subject stores data, sends notification to observers with new data
Subject pushes data to observers, observers pull data from subject - 8Benefits and drawbacks of ObserverBenefits: Very modular (subject and observer can vary independently), extensible, customizable
Drawbacks: Unexpected updates- observers do not know about each other, Update overhead - updating every observer for every change is excessive, Dangling pointers - use c++ smart pointers - 9—Subject - Allows observers to register for data of interest (notify, attach, detach)
Concrete Subject - Derived from subject, stores data we care about, calls notify when data changes.
Observer - Abstract class that defines attach and detach. Contains a purely virtual update method
Concrete Observer - Derived from Observer, implements update method that is called from the Subject, will do something with the data change
- 10SingletonEnsure a class only ever has one instance and provide a global point of access.
Allows us to have access to global instances without polluting the global namespace.
Benefits: Allows extension by subclassing, easy to change mind and not make class singleton.
Drawbacks: Implementation may be less efficient, concurrency pitfalls (use static instance function, or a supervisor class which will work at runtime). - 11Clean up of a SingletonSingleton Class itself owns each instance, and is responsible for creation and destruction. Ways to do it:
Implicit Destruction: Instances are deleted at termination of the method.
Reference Counter that keeps track of the creation of each singleton instance, calls destructor whens references hit 0. - 12Composite PatternTreat individual objects and multiple, recursively-composed objects uniformly.
Applicability: Objects must be composed recursively, no distinction between individual and composed elements, objects in structure can be treated uniformly. Very extensible and uniform, could have huge number of objects, awkward design - 13—Component - root class of the hierarchy, provides general interface for the other classes. (Component_Node)
Leaf - Inherits from component. Terminal node that implements the Component interface but does not contain any children (Leaf_Node)
Composite - Inherits from Component. May contain zero or more child Component Instances. (Composite_Binary_Node)
- 14—
Informações
- Descrição
- FlashCards sobre ISD Final, criado por nathan Hunsberger em 06-12-2021.
- Criado por
- nathan Hunsberger
- Visualizações
- 0
- Avaliação