Software Design Refinement Using Design PatternsOutlinePowerPoint PresentationDesign RefinementClass Diagram Refinement Using Design PatternsWhat is a Design PatternDefining a Design PatternExample of Pattern Definition: The Façade Pattern Provides An Interface To a SubsystemThe Facade PatternExample of Using the Design PatternSlide 11Another Example of Design PatternsThe Strategy PatternExamples of Design Patterns The Strategy PatternExamples of Design Patterns The Strategy Pattern: another exampleSlide 16Another example of using the Strategy Pattern: A Job Application SystemExamples of Design Patterns The State PatternSlide 19Slide 20Examples of Design PatternsSlide 22Slide 23Slide 24Slide 25Types of Design Patterns The Gang of Four (GoF) Patterns (Gamma et al 1995)Examples of Behavioral Design Patterns The Command Pattern: operator commands or user or customer requests are treated as a class of objectsThe Command PatternExamples of Behavioral Design Patterns The Observer Pattern: Multiple observer objects are notified when changes of states subjects occurThe Observer PatternExamples of Structural Design Patterns The Composite PatternExamples of Design Patterns The Composite Pattern :File System StructureExamples of Structural Design Patterns The Proxy Pattern (used heavily in communication software, CORBA, SOA )Design Patterns Examples and TutorialsSoftware Design RefinementUsing Design Patterns Instructor: Dr. Hany H. AmmarDept. of Computer Science and Electrical Engineering, WVUOutlineThe Requirements, Analysis, Design, and Design Refinement ModelsDesign refinementClass diagram refinement using design patternsDesign patterns examples–The Facade pattern–The Strategy Pattern–The State Pattern–The Command Pattern–The Observer Pattern–The Proxy PatternDesign Patterns TutorialsThe Requirements, Analysis, Design, and Desgin Refiement ModelsStatic Analysis Dynamic AnalysisFunctional/ NonfunctionalRequirementsUse Case Diagrams/Sequence Diagrams(the system level)- Analysis Class Diagrams- State Diagrams/Refined Sequence Diagrams (The object level)Requirements ElicitationProcessThe AnalysisProcessStatic ArchitecturalDesign Dynamic DesignThe DesignProcess:• Initial Design•Design Refinement• Design Class Diagrams • Design Sequence DiagramsDesign Refinement• Refined Design Class DiagramsDesign RefinementIt is difficult to obtain a quality design from the initial designThe initial design is refined to enhance design quality using the software design criteria of modularity, information hiding, complexity, testability, and reusability.New components (or new classes) are defined and existing components (or classes) structures are refined to enhance design qualityThe design refinement step is an essential step before implementation and testing.Class Diagram RefinementUsing Design Patterns Design Class Diagrams are further refined to enhance design quality (i.e., reduce coupling, increase cohesion, and reduce component complexity) using design patternsA design pattern is a documented good design solution of a design problemRepositories of design patterns were developed for many application domains (communication software, agent-based systems, web applications)Many generic design patterns were defined and can be used to enhance the design of systems in different application domainsWhat is a Design PatternWhat is a Design Pattern? A design pattern describes a design problem which repeatedly occurred in previous designs, and then describes the core of the solution to that problem Solutions are expressed in terms of classes of objects and interfaces (object-oriented design patterns)A design pattern names, abstracts, and identifies the key aspects of a high quality design structure that make it useful for creating reusable object-oriented designsDefining a Design PatternDesign Patterns are documented in the literature by a template consisting of the followingA Design Pattern has 5 basic parts:1. Name2. Problem3. Solution4. Consequences and trade-of of application5. Implementation: An architecture using a design class diagramExample of Pattern Definition: The Façade Pattern ProvidesAn Interface To a SubsystemThe Facade PatternThe class Facade is introduced as an interface to the whole subsystem.Any client class needs a service from any of the subsystem classes will be send the request to the facade class.All the subsystem interfaces are combined in one classExample of Using the Design PatternDesign Patterns produce quality designs by reducing couplingExample of how a Façade Pattern reduces couplingAnother Example: The Strategy Pattern templateAnother Example of Design PatternsThe Strategy Pattern: lets the algorithm vary independently from clients that use it Abstract ClassController ClassControl Strategy AControl Strategy B Control Strategy CDefault control StrategyThe Strategy PatternThe Strategy Pattern Context class has multiple control strategies provided by the concrete strategy classes, or by the abstract strategy (by default) The pattern lets us vary the algorithm that implements a certain function during run time depending on the conditions of the system The Pattern reduces coupling by having the client class be coupled only to the context classExamples of Design PatternsThe Strategy PatternExample of using the pattern in JAVA AWT GUI components lay out managersExamples of Design PatternsThe Strategy Pattern: another exampleSituation: A GUI text component object wants to decide at runtime what strategy it should use to validate user input. Many different validation strategies are possible: numeric fields, alphanumeric fields, telephone-number fields, etc.Exampleof using the StrategyPattern: SpeedControlIs the Strategy classAnother example of using the Strategy Pattern: A Job Application SystemThe complexity of class JobApplication is reduced by moving the validate() operation to the Strategy Pattern classesHostValidatorvalidate()(from patterns)ManagerValidatorvalidate()(from patterns)WaitStaffValidatorvalidate()(from patterns)BartenderVali datorvalidate()(from patterns)BusValidatorvalidate()(from patterns)JobApplicantCli entmain()runTest()(from common)ApplicantRuleFactorygetAppli cantValidationRule()(from patterns)JobApplicantFormJOB_MANAGER : int = 1JOB_WAIT_STAFF : int = 2JOB_BUSSER : int = 3JOB_BARTENDER : int = 4JOB_HOSTER : i nt = 5position : intname : Stringphone :
or
We will never post anything without your permission.
Don't have an account? Sign up