Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-1 PS95&96-MEF-L1-1 Dr. M.E. Fayad Creationa l Paradigm.

Similar presentations


Presentation on theme: "Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-1 PS95&96-MEF-L1-1 Dr. M.E. Fayad Creationa l Paradigm."— Presentation transcript:

1 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-1 PS95&96-MEF-L1-1 Dr. M.E. Fayad Creationa l Paradigm Shift, Inc. Software Factory Behaviora l Structural Lesson 1: Introduction Object-Oriented Design Patterns

2 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-2 PS95&96-MEF-L1-2 Dr. M.E. Fayad Lesson Objectives oBe able to use patterns to define good design oUnderstand why design patterns are important oDiscuss the process of discovering design patterns oPresent other common techniques for reuse oLearn the answers of the following questions: ï What is a pattern? ï Where can we look to understand more about patterns? ï What are some examples of what might be considered patterns? and how can we catalog them? ï What is the process of discovering patterns? ï What is the potential impact of patterns?

3 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-3 PS95&96-MEF-L1-3 Dr. M.E. Fayad Introduction Object-oriented design patterns and frameworks help to improve key software quality factors –e.g., reuse, extensibility, modularity, performance OO design patterns support reuse of software architecture –Design patterns capture the static and dynamic structures and collaborations of successful solutions to problems that arise when building applications in a particular domain. Frameworks support reuse of design and code –A framework is a set of cooperating classes that make up a reusable design for a specific domain

4 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-4 PS95&96-MEF-L1-4 Dr. M.E. Fayad [Webster] A pattern is a fully realized form, original, or model accepted, or proposed for imitation. [Webster] A pattern is something regarded as normative example to be copied; archetype ; exemplar. [Alexander 79] A pattern is a solution to a problem in a context. [Alexander 79] A pattern has three parts: –Problem(s) –Context –Solution A pattern offers a workable solutions. Patterns are rules of thumbs that can be used again and again -- useful, practical “how-to” guideline. Design Patterns: Properties & Definitions

5 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-5 PS95&96-MEF-L1-5 Dr. M.E. Fayad [Gamma 95.] Design patterns identify, name, and describe common and recurring designs appearing frequently in object-oriented systems. [Gamma 95] You can think of a design pattern as a micro architecture that contributes to overall system architecture. Each design pattern tends to be relatively small in size and scope. [Coplien 92] Patterns are a way of describing, documenting, and creating system architectures for software. Patterns tend not to be domain specific. Patterns are one of the primary mechanisms that people use for passing on expertise to others. Design Patterns: More Properties & Definitions

6 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-6 PS95&96-MEF-L1-6 Dr. M.E. Fayad Patterns of Learning Solutions to most challenging areas of human endeavor are deeply rooted in patterns –An important goal of education and training is to transmit patterns from generation to generation. We will use the analogy of learning to play chess to explore the use of design patterns In many ways, learning to develop good software is similar to learning to play good chess –Though the consequences of failure are often less dramatic

7 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-7 PS95&96-MEF-L1-7 Dr. M.E. Fayad Becoming a Chess Master First learn rules and physical requirements –e.g., names of the pieces, legal movements, chess board geometry and orientation, etc. Then learn principles –e.g., relative value of certain pieces, strategic value of center squares, power of a thread, etc. Study the games of other masters –These games contain patterns that must be understood, memorized, and applied repeatedly There are thousands upon thousands of these patterns

8 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-8 PS95&96-MEF-L1-8 Dr. M.E. Fayad Becoming a Master Software Designer First learn rules and physical requirements –e.g., the algorithms, data structures, software methods and techniques, analysis guidelines, etc. Then learn principles of software engineering –e.g., modularity, information-hiding, OO analysis, design, and programming, etc. Study the designs of other masters –These designs contain patterns that must be understood, memorized, and applied repeatedly There are thousands upon thousands of these patterns

9 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-9 PS95&96-MEF-L1-9 Dr. M.E. Fayad Design Patterns Design Patterns represent solutions to problems that arise when developing software within a particular context –Patterns == problem/solution pairs in a context Design Patterns capture the static and dynamic structure and collaboration among key participants in software designs –Design patterns are particularly useful for articulating how and why to solve non-functional forces Design Patterns facilitate reuse of successful software architecture and design

10 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-10 PS95&96-MEF-L1-10 Dr. M.E. Fayad  Pattern’s Name –A handle –Part of Design Vocabulary –Makes it easier to think about design and to communicate them and their trade-offs to others –Finding good names is hard  Design Problem –Describes when to apply the pattern –Explains the problem and its context –Might describe a class or object structures that are symptomatic of an inflexible design –Might describe assumptions or a list of conditions before applying the pattern A Design Pattern Has Four Essential Elements (1) Abstract Factory Pattern’s Name: Design Problem: Solution: Consequences: Design Pattern’s Description Form

11 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-11 PS95&96-MEF-L1-11 Dr. M.E. Fayad  Solution –Describes the elements that make up the design, their relationships, responsibilities, and collaborations –Doesn’t describe a particular concrete design because a pattern is like a template that can be applied in many different situations  Consequences –The result and trade-offs of applying the pattern. –Critical for evaluating design alternatives and understanding the cost and the benefits of applying the pattern –Includes the pattern’s impact on a system’s flexibility, extensibility, or portability. A Design Pattern Has Four Essential Elements (2) Abstract Factory Pattern’s Name: Design Problem: Solution: Consequences: Design Pattern’s Description Form Design pattern descriptions are often independent of programming languages or implementation details Design pattern descriptions are often independent of programming languages or implementation details

12 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-12 PS95&96-MEF-L1-12 Dr. M.E. Fayad Design Pattern Space  Creational Patterns  Deal with initializing and configuring classes and objects  Structural Patterns  Deal with decoupling interface and implementation of classes and objects  Behavioral Patterns  Deal with dynamic interactions among societies of classes and objects Design Patterns Catalog

13 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-13 PS95&96-MEF-L1-13 Dr. M.E. Fayad Samples of Creational Patterns  Abstract Factory  Factory for building related objects  Builder  Factory for building complex objects incrementally  Factory Method  Method in a derived class creates associates  Prototype  Factory for cloning new instances from a prototype  Singleton  Factory for a singular (Sole) instance Design Patterns Catalog

14 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-14 PS95&96-MEF-L1-14 Dr. M.E. Fayad Samples of Structural Patterns  Adapter  Translator adapts a server interface for a client  Bridge  Abstraction for binding one of many implementations  Composite  Structure for building recursive aggregations  Decorator  Decorator extends an object transparently  Flyweight  Many fine-grained objects shared efficiently Design Patterns Catalog

15 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-15 PS95&96-MEF-L1-15 Dr. M.E. Fayad Samples of Behavioral Patterns (1)  Chain of Responsibility  Request delegated to the responsible service provider  Command  Request as First-Class object  Mediator  Mediator coordinates interactions between its associates  Memento  Snapshot captures and restores object states privately Design Patterns Catalog

16 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-16 PS95&96-MEF-L1-16 Dr. M.E. Fayad Samples of Behavioral Patterns (2)  Interpreter  Language interpreter for a small grammar  Iterator  Aggregate elements are accessed sequentially  Strategy  Abstraction for selecting one of any algorithms  Observer  Dependents update automatically when a subject changes  State  Object whose behavior depends on its state Design Patterns Catalog

17 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-17 PS95&96-MEF-L1-17 Dr. M.E. Fayad The Process of Discovering Patterns  Experience  Do it yourself  Building things and watch yourself as you build them  Watch others doing it  Watch others performing or building things. This is called Protocol Analysis  Catalog what you have done  Teach and learn

18 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-18 PS95&96-MEF-L1-18 Dr. M.E. Fayad The Potential impact of Patterns H U G E

19 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-19 PS95&96-MEF-L1-19 Dr. M.E. Fayad Why? Patterns provide:  A basis for architectural consistency  A higher-level (design) approach for software problems  A higher-level style convention  A teaching vehicle Design Patterns Make Some of the Chaotic Problems Simple. Design Patterns Make Some of the Chaotic Problems Simple.

20 Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-20 PS95&96-MEF-L1-20 Dr. M.E. Fayad Why are Design Patterns Important?  Achieving Software Design Reuse  A reusable Base of Experience  A Documentation and Learning Aid  A Target for Refactoring  An Adjunct to Existing Methodologies ‘ Architectural Elements ’ Delegation and Double Dispatch “ Enhancing Communication ” Enhancing Maintainability


Download ppt "Copyright © 1995-2004 Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-1 PS95&96-MEF-L1-1 Dr. M.E. Fayad Creationa l Paradigm."

Similar presentations


Ads by Google