¡GoConqr estrena diseño! Cuéntanos qué te parece.

Fichas

ISD Final

nathan Hunsberger Engineering Inglés 45 fichas

ISD Final

Fichas del conjunto (45)

  1. 1Goal 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
  2. 2PatternMatch problem to design experience.
    Abstract and name recurring design structure
    (Name, problem, solution, consequences)
    Language and implementation indpendent
  3. 3Benefits/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
  4. 4—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
    Abstraction - Coordinates the interface, defines abstract base class (Expression_Tree) Refined Abstraction - Extends the Abstraction for ...
  5. 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
  6. 6AdapterClient - User calling the target
    Target - The new interface
    Adapter - Translates from target to the Adaptee
    Adaptee - The existing legacy code
    Adapter
  7. 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
  8. 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. 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
    Subject - Allows observers to register for data of interest (notify, attach, detach) Concrete Subject - Derived from subject, stores data...
  10. 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).
  11. 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.
  12. 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. 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)
    Component - root class of the hierarchy, provides general interface for the other classes. (Component_Node) Leaf - Inherits from componen...
  14. 14InterpreterParses expressions into parse tree and generates corresponding expression tree. Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language. Translate from a textual representation of a language to a parsed set of symbols. Best when grammar is simple. SPECIALIZED VERSION OF COMPOSITE PATTERN FOR GRAMMAR
  15. 15InterpreterAbstractExpression is the root of the hierarchy, it's the component.
    Terminal Expression - derives from Abstract Expression, leaf node.
    NonTerminal Expression - Same as leaf but could have children
    Interpreter
  16. 16BuilderSeparate the construction of a complex object from its representation so that the same construction process can create different representations. Applicability: Need to isolate knowledge of creation from its parts, need to allow different implementations/interfaces of an object's parts.
    Can involve a lot of classes. Factory Pattern with a mission. Avoids coupling to allow interpreter and composite patterns to vary independently. Creates composite nodes
  17. 17—Director - Higher level class that initiates and coordinates the builder. Usually contains the objects that implement the pattern. This is the Interpreter in ETA
    Builder - Abstract interface. Used as interface for director to initiate build process. Symbol class.
    Concrete Builder - actual classes that implement builder pattern. Inherit from Builder. Generate actual product. Number, Subtract, Add.
    Product - Output from builders. This is Component_Node's children, so Composite_Multiply_Node, Leaf_Node, exc.
    Director - Higher level class that initiates and coordinates the builder. Usually contains the objects that implement the pattern. This i...
  18. 18IteratorExpression_Tree_Iterator. Access elements of a container without exposing its representation. Requires a uniform traversal interface. When classes and traversal algorithms must vary independently
  19. 19—Aggregate - Abstract interface class that defines how to get an iterator from a container
    Concrete Aggregate - Container implementation that has methods for getting an appropriate concrete iterator. (LIKE FACTORY PATTERN).
    Iterator - Abstract interface class that defines the expected behavior of any iterator
    Concrete Iterator - Container-specific iterator implementation that implements the abstract iterator interface
    Aggregate - Abstract interface class that defines how to get an iterator from a container Concrete Aggregate - Container implementation t...
  20. 20VisitorDefines actions at each step of traversal and avoids wiring actions in nodes. Common accept() method for all nodes, subclassed to support variability. Algorithm and object structure are independent.
    Centralize operations on an object structure so that they can vary
    independently but still behave polymorphically. Uses method overloading.
  21. 21—Object Structure - Structure in our program which was call the node's accept function. For ETA, this is the Expression Tree. Controls order the node's accept() is called
    Element - Root node that defines and accepts. Component_Node
    Concrete Element - Actual node, like Composite_Multiply_Node
    Visitor - Base class that declares visit methods for every concrete elements
    ConcreteVisitor - Actually performs an action based on the node that called visit()
    Object Structure - Structure in our program which was call the node's accept function. For ETA, this is the Expression Tree. Controls ord...
  22. 22Visitor Benefits and DrawbacksBENEFITS:
    Flexible - Structure of objects and algorithms is independent
    Functionality is localized in the subclasses
    DRAWBACKS:
    Circular Dependency between Visitor and Element Interfaces
    Visitor brittle to new Concrete Element classes
  23. 23BridgeSeparate a logical abstraction interface from its physical implementations. Interface and implementation should vary independently. Uniform interface to interchangeable class hierarchies. Encapsulate variability of implementor
  24. 24Bridge Benefits and DrawbacksBENEFITS:
    Abstract interface and implementation are independent, implementations can vary dynamically, STL compatible.
    Decouple the interface from the implementation
    DRAWBACKS:
    one-size-fits-all abstraction and implementor interfaces
  25. 25CommandEncapsulate the request for a service. Parameterize objects with an action to perform. specify, queue, and execute requests at different times. undo/redo.
  26. 26—Invoker - Interface with command to execute it
    Command -Interface for communication with the user
    Target - Where action takes place
    Concrete Command - Actually executes the command
    Invoker - Interface with command to execute it Command -Interface for communication with the user Target - Where action takes place Concr...
  27. 27Benefits and Drawbacks of CommandBENEFITS:
    Abstracts executor of a service, supports undo/redo, composition yields macro-commands
    DRAWBACKS:
    may result in lots of trivial command subclasses, Doesn't scale well
  28. 28FactoryProvide an interface for creating an object, but leave the choice of the object's concrete type to a subclass. One class creates an instance of another
    USE WHEN: When a class cannot anticipates the objects it must create or a class wants its to specify the objects it creates.
  29. 29—Product -
    Concrete Product -
    Creator -
    Concrete Creator -
    Product - Concrete Product - Creator - Concrete Creator -
  30. 30Factory Benefits and DrawbacksBENEFITS:
    By avoiding specifying the class name of the concrete class and the details of its creation, client code becomes more flexible. Client is only dependent on interface
    DRAWBACK:
    Construction of objects requires an additional class
  31. 31Abstract FactoryCreate families of related objects without specifying subclass names. When clients cannot anticipate groups of classes to instantiate. Loosen the relationship
    Multiple factory types that produce the same types of products
    Possibility of multiple different approaches to create objects
  32. 32—Abstract Factory -
    Concrete Factory -
    Abstract Product A -
    Product A -
    Abstract Factory - Concrete Factory - Abstract Product A - Product A -
  33. 33State / Behavior / TransitionBehavior is decomposed into discrete states.
    State - distinguishable, disjoint, condition that persists for a period of time.
    Transition - Change from one state to another
  34. 34State Pattern defiitionAllow an object to alter its behavior when its internal state changes - the object will appear to change its class. Applicable when an object must change behavior at runtime depending on which state it is in. Several operations have same large multipart conditional structure that depends on object's state
  35. 35—Context -
    State -
    Concrete State A -
    Context - State - Concrete State A -
  36. 36State Benefits and DrawbacksBENEFITS:
    Localizes state-specific behavior and partitions behavior for different states. Makes state transitions explicit. State objects can be shared.
    DRAWBACKS:
    Can result in LOTS of subclasses
  37. 37ReactorAllows event-driven applications to demultiplex and dispatch service requests that are delivered to an application from one or more clients. Provides a common interface for managing and processing events via callbacks to abstract event handlers USES: need to decouple event handling from event detecting. Multiple sources of events must be handled in a single thread.
  38. 38—Reactor - Dispatches events to event handler
    Event Handler - Base class to outline expected behaviors of an event handler
    Concrete Event Handler A - Will handle (execute) the event passed to it
    Synchronous Event Demuxer - Receives event, calls handle to allow reactor to send this to an event handler.
    Reactor - Dispatches events to event handler Event Handler - Base class to outline expected behaviors of an event handler Concrete Event ...
  39. 39Reactor againEvent Handler does actual work, Reactor is responsible for coordination and planning of the work
  40. 40TemplateProvide a skeleton of an algorithm in a method, deferring some steps to subclasses. USES: Implement invariant aspects of an algorithm once and let subclasses define variant parts. Localize common behavior in a class to increase code reuse, control subclass extensions. USES POLYMORPHISM.
  41. 41Benefits and drawbacks of TemplateBENEFITS:
    Inversion of control, promotes code reuse, enforce overriding.
    DRAWBACKS:
    Must subclass to specialize behavior
  42. 42StrategyDefine a family of algorithms, encapsulate each one, and make them interchangeable to let clients and algorithms vary independently from the clients that use it. USES: when an object should be configurable with one of many algorithms, all algorithms can be encapsulated, one interface covers all encapsulations. USES STATIC INHERITANCE
  43. 43—Context -
    Strategy -
    Concrete Stategies-
    Context - Strategy - Concrete Stategies-
  44. 44Strategy Benefits and DrawbacksBENEFITS:
    Greater flexibility, less reuse. Can change algorithms dynamically.
    DRAWBACKS:
    Strategy creation and communication overhead, inflexible interface, semantic incompatibility of multiple strategies used together
  45. 45Reactor vs ObserverObserver is more about data changing, Reactor is more about events needing to be handled.

Información

Descripción
Engineering Fichas sobre ISD Final, creado por nathan Hunsberger el 06/12/2021.
Visitas
11
Historial
  • Creado por nathan Hunsberger · 6 dic 2021
  • Copiado por nathan Hunsberger · 6 dic 2021
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?