Advanced Object-Oriented Design Patterns and Architectures Part One COEN396A John Xiao
Motivations It’s difficult to write good software It’s really difficult to write good, reusable software Where has OO failed to deliver? –where are the big success stories?
Course Home Page Information available at Course description Schedule Homeworks Handouts Patterns Project
Course Description Three primary topics: –design patterns –frameworks –component-based software engineering Advanced OO reuse constructs –Design –Implementation References at
Prerequisites Object-oriented analysis and design (Booch, Rumbaugh, Jacobson, UML) Object-oriented programming (C++, Java)
Patterns Project Team-oriented Pick pattern(s) Implementation in Java (Beans)
Patterns Project 30 minute class presentation –demo the pattern/discuss issues Prepare homework assignment –concrete design/implementation –reflective component Web page –summary, details, links to info Review –review other teams
Possible Groupings observer,mediator abstract factory,building,factory method prototype,singleton,flyweight adapter,bridge,decorator façade,interpreter state,strategy,template method composite,iterator,visitor command,interpreter OR memento, serialization visitor critiques
Deliverables Presentation Assignment Assignment Solution Web page Review
Deadlines See Syllabus
Patterns of Learning Successful solutions to human endeavors are often rooted in patterns Example: becoming a chess master –first learn the rules and physical requirements (pieces, legal moves, board layout, etc) –then learn principles (relative value of pieces, value of center squares, etc) –to become master: study games of other masters memorize their playing patterns –there are hundreds/thousands of patterns
Becoming a software design master first learn the rules (algorithms, data structures, languages) then learn principles (structured programming, object-oriented programming, functional programming) to become master: study designs of other masters memorize their designing patterns, apply them repeatedly there are hundreds/thousands of patterns
OOA Review OOA –Requirement Analysis –Use Cases/Use Case Diagrams High-level vs. expanded Essential vs. real –Conceptual Model/Class Diagrams Concepts/Classes Attributes Associations/Associative Type Aggregation(Composite/Shared) Generalization –System Sequence Diagrams –Contracts
OOD Review OOD –Interaction Diagrams (e.g. Collaboration Diagrams) (from real use cases) Design patterns Visibility (attribute/parameter/local/global) –Design Class Diagrams … Interfaces Methods Navigability Attributes type info
Design level reuse szyperski Sharing consistency: programming languages Sharing concrete solution fragments: libraries Sharing individual contracts: interfaces Sharing individual interaction architectures: patterns Sharing architectures: frameworks Sharing overall structure: system architectures Systems of subsystems: framework hierarchies
Patterns vs Frameworks vs Components patterns support reuse of software architecture and design capture static and dynamic structure and collaborations of successful solutions to common problems frameworks/components support reuse of detailed design and code an integrated set of software constructs that collaborate to provide a reusable architecture for a family of related applications
Design Patterns Gamma, Helm, Johnson, Vlissides (GOF) Studied “super programmers” Catalogued patterns Design patterns solve problems that are: –in every single program you will ever write Generic problem/Generic solution Specific problem/customization of generic solution
What is a pattern? Description of a problem/solution pair in a certain context Originate from architecture –Christopher Alexander 1977 –Explicit design expertise and experience Designing a house versus designing a program Building a house versus building a program
Pattern Format Format –Name –Context –Problem –Solution –…. Kinds –architectural (overall description) –design patterns (design problems) –idioms (language specific)
Example: Singleton See book
Patterns Review Expert Creator Controller Low Coupling High Cohesion Polymorphism Pure Fabrication Indirection Law of Demeter