Download presentation
Presentation is loading. Please wait.
Published byCornelia Jackson Modified over 9 years ago
1
Chapter 21 Design Patterns Reviewed from the New Perspective of Object-Oriented Design Ku-Yaw Chang canseco@mail.dyu.edu.tw Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University
2
2Ku-Yaw ChangDesign Patterns Reviewed Outline A Summary of Object-Oriented Principles How Design Patterns Encapsulate Implementations Commonality/Variability Analysis and Design Patterns Decomposing a Problem Domain into Responsibilities Relationships Within a Pattern Patterns and Contextual Design Field Notes Summary
3
3Ku-Yaw ChangDesign Patterns Reviewed A Summary of Object-Oriented Principles Objects are things with well-defined responsibilities. Objects are responsible for themselves. Encapsulation means any kind of hiding Data hiding Data hiding Class hiding Class hiding Implementation hiding Implementation hiding Abstract out variations in behavior and data with commonality/variability analysis. Design to interfaces.
4
4Ku-Yaw ChangDesign Patterns Reviewed A Summary of Object-Oriented Principles Think of inheritance as a method of conceptualizing variation, not for making special cases of existing objects. Keep variations in a class decoupled from other variations in the class. Strive for loose coupling. Strive for high cohesion. Be absolutely meticulous in applying the once and only once rule
5
5Ku-Yaw ChangDesign Patterns Reviewed Outline A Summary of Object-Oriented Principles How Design Patterns Encapsulate Implementations Commonality/Variability Analysis and Design Patterns Decomposing a Problem Domain into Responsibilities Relationships Within a Pattern Patterns and Contextual Design Field Notes Summary
6
6Ku-Yaw ChangDesign Patterns Reviewed How Design Patterns Encapsulate Implementations Most patterns described by GoF Give ways to hide specific implementations Give ways to hide specific implementations Allow for easily adding new implementations Allow for easily adding new implementations
7
7Ku-Yaw ChangDesign Patterns Reviewed Outline A Summary of Object-Oriented Principles How Design Patterns Encapsulate Implementations Commonality/Variability Analysis and Design Patterns Decomposing a Problem Domain into Responsibilities Relationships Within a Pattern Patterns and Contextual Design Field Notes Summary
8
8Ku-Yaw ChangDesign Patterns Reviewed Commonality/Variability Analysis and Design Patterns An example Draw a square with drawing program one Draw a square with drawing program one Draw a circle with drawing program two Draw a circle with drawing program two Draw a rectangle with drawing program one Draw a rectangle with drawing program one Tow commonalities Drawing programs Drawing programs Shapes to draw Shapes to drawPatterns Provide the backdrop in analysis and design Provide the backdrop in analysis and design Give a common vocabulary for discussion Give a common vocabulary for discussion Incorporate best-practice approaches into your code Incorporate best-practice approaches into your code
9
9Ku-Yaw ChangDesign Patterns Reviewed Outline A Summary of Object-Oriented Principles How Design Patterns Encapsulate Implementations Commonality/Variability Analysis and Design Patterns Decomposing a Problem Domain into Responsibilities Relationships Within a Pattern Patterns and Contextual Design Field Notes Summary
10
10Ku-Yaw ChangDesign Patterns Reviewed Decomposing a Problem Domain into Responsibilities In the Bridge pattern Problem domain composed of two different types of entities Problem domain composed of two different types of entitiesAbstractionsImplementations Decompose the problem domain Objects Objects Which objects are needed Responsibilities Responsibilities How these objects are instantiated
11
11Ku-Yaw ChangDesign Patterns Reviewed Outline A Summary of Object-Oriented Principles How Design Patterns Encapsulate Implementations Commonality/Variability Analysis and Design Patterns Decomposing a Problem Domain into Responsibilities Relationships Within a Pattern Patterns and Contextual Design Field Notes Summary
12
12Ku-Yaw ChangDesign Patterns Reviewed Relationships Within a Pattern Alexander At this final stage, the patterns are no longer important. At this final stage, the patterns are no longer important.Shalloway The patterns have taught your to be receptive to what is real. The patterns have taught your to be receptive to what is real. Relationships and forces described by the patterns It is not the patterns themselves that are important It is not the patterns themselves that are important
13
13Ku-Yaw ChangDesign Patterns Reviewed Outline A Summary of Object-Oriented Principles How Design Patterns Encapsulate Implementations Commonality/Variability Analysis and Design Patterns Decomposing a Problem Domain into Responsibilities Relationships Within a Pattern Patterns and Contextual Design Field Notes Summary
14
14Ku-Yaw ChangDesign Patterns Reviewed Patterns and Contextual Design Patterns are microcosmic examples of contextual design Designing to an interface is designing within a context
15
15Ku-Yaw ChangDesign Patterns Reviewed Outline A Summary of Object-Oriented Principles How Design Patterns Encapsulate Implementations Commonality/Variability Analysis and Design Patterns Decomposing a Problem Domain into Responsibilities Relationships Within a Pattern Patterns and Contextual Design Field Notes Summary
16
16Ku-Yaw ChangDesign Patterns Reviewed Field Notes What implementations does this pattern hide? Allow for changing them Allow for changing them What commonalities are present in this pattern? Identify them Identify them What are the responsibilities of the objects in this pattern? Easier to do my decomposition by responsibility Easier to do my decomposition by responsibility
17
17Ku-Yaw ChangDesign Patterns Reviewed Field Notes What are the relationships between these objects? More information about the forces More information about the forces How may the pattern itself be a microcosmic example of designing by context A better understanding of why the pattern is good design A better understanding of why the pattern is good design
18
18Ku-Yaw ChangDesign Patterns Reviewed Outline A Summary of Object-Oriented Principles How Design Patterns Encapsulate Implementations Commonality/Variability Analysis and Design Patterns Decomposing a Problem Domain into Responsibilities Relationships Within a Pattern Patterns and Contextual Design Field Notes Summary
19
19Ku-Yaw ChangDesign Patterns Reviewed Summary Look at patterns by seeing What they encapsulate What they encapsulate How they use commonality/variability analysis How they use commonality/variability analysis How they decompose a problem domain into responsibilities How they decompose a problem domain into responsibilities How they specify relationships between objects How they specify relationships between objects How they illustrate contextual design How they illustrate contextual design
20
The End
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.