1 / 13

Advanced Design Topics

Advanced Design Topics. General OO Design Principles. Responsibility driven Strongly cohesive Weakly coupled Protection from variations Indirection. Design Patterns. Represents a generic solution to a recurring problem capture and document the experience in software design

carl
Télécharger la présentation

Advanced Design Topics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advanced Design Topics

  2. General OO Design Principles • Responsibility driven • Strongly cohesive • Weakly coupled • Protection from variations • Indirection

  3. Design Patterns • Represents a generic solution to a recurring problem • capture and document the experience in software design • support reuse for proven problems • provide common vocabulary for software designers

  4. Design Patterns • Classifications • Creational • Structural • Behavioral • Description make up • Pattern name • Classification • Intent • Problem or situations when the pattern can be applied • Example or structure

  5. Design Pattern: Iterator Classification: Behavioral design pattern Intent: Provide a way to access the elements of an aggregate object. Problem: We need a way to access the contents of an aggregate object without exposing the underlying representation. Structure: The aggregate object will provide a mediator object for the sole purpose of sequential access. This mediator object can be aware of the representation of the aggregate while those details are hidden from the client.

  6. Abstract Aggregate class Concrete Aggregate class Abstract Iterator class Concrete Iterator class Abstract iterator() concrete iterator() Abstract hasNext() Abstract next() Concrete hasNext() Concrete next() Iterator Pattern Structure Returns an iterator

  7. Design Pattern: Singleton Classification: Creational design pattern Intent: Ensure that a class has only one instance and provide a global point of access. Problem: Only one instantiation of a class is allowed. The instantiation (new) can be called from several places in the system. The first reference should make a new instance, and later attempts should return a reference to the already instaniated object. Structure: The pattern class declares a unique instance of the class as a state variable and defines getInstance for clients to access the unique instance.

  8. Singleton static getInstance() operation() getData() Singleton Pattern Structure return the instance static singleton instance data

  9. Design Pattern: Adapter Classification: Structural design pattern Intent: To link a new class to an old interface with minimal impact. Problem: A class must be replaced, or is subject to being replaced, by another standard. The replacing class already has a predefined set of method signatures that are different from the method signature of the original class. Structure: The pattern defines a new class which serves as a link between the original system and the class to be replaces. The class does little work itself but merely translates commands from one form to another.

  10. function1() – calls f1() function2() – calls f2() f1() f2() fOne() fTwo() f1() – calls fOne() f2() – calls fTwo() Client Old Server New Server Adapter Adapter Pattern Structure

  11. Design Pattern: Observer Classification: Behavioral design pattern Intent: To allow two or more independent and loosely coupled objects to change in synchrony with each other. Problem: There are multiple objects that need to be updated to know when certain events occur in another object. The original objects needs to notify those objects that something has changed. Structure: The pattern defines methods that allow other objects to register with it. A list of those objects is maintained and they are notified that they should update themselves.

  12. Observer Pattern Structure

  13. Order Example

More Related