Professional Documents
Culture Documents
10/2/2001
Part I: Introduction
10/2/2001
Everyone knows about how important design work is Very few people really do design before coding Consequence:
Messy applications Inability of maintenance and upgrades Many reworks
Purpose
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
Part I: Introduction
10/2/2001
Purpose
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
And
Know how we should apply design & architectural patterns effectively Using Rational Rose & UML for visual modeling work
Contents Map
I. Introduction I. Introduction
All projects start with customers needs! Where do I Istart from? All projects start with customers needs! Where do start from?
II. Requirement Capturing II. Requirement Capturing III. Architecture III. Architecture IV. Analysis IV. Analysis V. Design V. Design
Part I: Introduction
Think customers!
Goal-driven Use-Cases. A system view from users Goal-driven Use-Cases. A system view from users Think architecture first. All start from patterns. Subtractix approach. Think architecture first. All start from patterns. Subtractix approach. System view from the inside. What shall we have in the system. System view from the inside. What shall we have in the system. Blue-print for implementation. Howthe system will work. Patterns again. Blue-print for implementation. Howthe system will work. Patterns again.
VI. More About Patterns & Design Refinement VI. More About Patterns & Design Refinement Architectural Patterns, Design Heuristics, and so on Architectural Patterns, Design Heuristics, and so on
Jun 15, 2001 (c) 2001 24MB Software Development 6
10/2/2001
Part I. Introduction
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
Why OO?
Better modeling for the real world
Goals: Understanding of
Basic concepts and elements of OO paradigm Interaction mechanism of the OO world Benefits of OO methodology
Part I: Introduction
10/2/2001
Why UML?
Standardized, powerful language for Visual Modeling and just a language
Goals: Understanding of
Purpose of UML Basic concepts of the language Classification of UML diagrams and when to apply them during development process
Goals:
Understanding and using the notations of Rose effectively Ability to use Rose for visual modeling works
10
Part I: Introduction
10/2/2001
Learning goals:
Understanding whats a pattern Ability to apply patterns in design works
Techniques:
GRASP patterns GOF patterns POSA patterns
11
Learning Goals:
Understanding of how important requirement capturing is Understand Use-cases The modern form of requirements for a customer centric development process Ability of describing customer requirements using Use-cases
12
Part I: Introduction
10/2/2001
What to be done? How to capture requirements? Modeling techniques Guidelines Using use-cases patterns
13
Learning Goals:
Understand about software architecture and architectural patterns Ability to use architectural patterns and Subtractix approach in design works
14
Part I: Introduction
10/2/2001
How:
Architectural analysis Architectural design Refining architecture Analysis: Architecture refinement What Design: Architecture refinement How
15
What to be done?
Refinement of architecture focusing on WHAT
Learning goals:
Understanding and ability to do basic analysis techniques: finding analysis classes, using analysis diagram
16
Part I: Introduction
10/2/2001
How to analyze system requirements? How to find analysis classes? Modeling Techniques: how to using class diagrams, state chart diagrams for visual modeling the analysis model Guidelines Using analysis patterns
17
What to be done?
Refinement of architecture focusing on HOW. Blue-print for implementation.
Learning goals:
Understanding of design techniques and design pattern. Ability to using these techniques to complete design sessions.
18
Part I: Introduction
10/2/2001
19
Architectural & Design patterns review Additional design principles and heuristics
20
Part I: Introduction
10
10/2/2001
During this course, you will be developing a Point of Sale (POS) application for a fictional company called Classics, Inc. Classics, Inc. is a rapidly growing chain of retail stores that sells classical music, classic movies, and classic books. Classics, Inc. has outgrown its Point of Sale application and now must create a new Order Processing and Fulfillment System (OPFS). As you progress through the course, you will develop the OPFS to help Classics Inc. better manage their stores and inventory.
21
Lesson Structure
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
Lessons are supported with guidelines and techniques During lessons, students have to exercise with activities and labs to reenforce learned knowledge
22
Part I: Introduction
11
10/2/2001
23
Learning Goals
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
24
Part I: Introduction
12
10/2/2001
Static Aspect
Objects and classes Abstraction and encapsulation
Dynamic Aspect
Methods and messages Interfaces, inheritance, and polymorphism Access control
25
26
Part I: Introduction
13
10/2/2001
Learning Objectives
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Introducing the object-oriented principles Outline the limitations associated with the traditional approach and the ways to improve Explain the concept of the object and class Describe the role of objects and classes Describe the way in which classes handle data
(c) 2001 24MB Software Development 27
Abstraction and encapsulation (and data hiding) Inheritance Polymorphism and dynamic binding
28
Part I: Introduction
14
10/2/2001
Support the principles of good programming Provide software of high-quality Fulfill user expectations Make code more portable and more reliable Reduce development costs Make code better represent real-world objects
29
Modularity Reusability Extensibility Ease of maintenance Preservation of data integrity Efficient debugging
30
Part I: Introduction
15
10/2/2001
31
Express all problems domain entities through the concept of objects Model the real-world better than others Focus specifically on the problems and not be mired in the details Promoting to reuse previous work Allows to extend or enhance your system without modifying or breaking existing code
32
Part I: Introduction
16
10/2/2001
33
What Is An Object?
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Objects are a natural thing to model Can be identified, classified, and defined Represented in a system Has a set of attributes that describe it Attribute is something that is internal to an object
34
Part I: Introduction
17
10/2/2001
Example
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
yellow circle yellow circle cyan square cyan square purple rectangle purple rectangle
Circle, rectangle, square are objects Yellow, purple, cyan are their attributes All of them belong to a group of object: shape objects
35
Everything Is An Object
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Express all problem domain entities Comprise data and the methods work on that data
36
Part I: Introduction
18
10/2/2001
Create an accurate representation of the problem domain Map this representation into the final program Modularizes information as well as processing
37
Object Relationships
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
38
Part I: Introduction
19
10/2/2001
Association
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Semantic connection between objects Allows one object to know about the public attributes & operations of another object
39
Aggregation
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Stronger form of association The relationship between a whole and its parts One object may have several aggregation relationships with other objects
40
Part I: Introduction
20
10/2/2001
Specialization
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
An inheritance relationship between two objects Allows one object to inherit the attributes of another
41
What Is a Class?
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Think as simply a type that has associated methods Define both the data and the operation on that data A blueprint for objects that share a similar structure or behavior A blueprint for a given set of functionality
42
Part I: Introduction
21
10/2/2001
Its data The operations that may be performed on it The operations that it may perform on other classes
43
Each class is a syntactical unit Independent stand-alone modules "Decoupled" from each other
44
Part I: Introduction
22
10/2/2001
May contain another class as its data members Containment is not confined to a single level Access to the contained classes is strictly controlled The contained class is private
45
Can be organized into class hierarchies Class hierarchies show relationship between classes Class hierarchies are usually represented as an inverted tree The top of the hierarchy is known as the root Root is the source of the shared characteristics
46
Part I: Introduction
23
10/2/2001
class MyPoint { private: int x, y; public: MyPoint (); MyPoint(int x, int y); // copy constructor MyPoint(MyPoint& pt); // operators void operator =(const MyPoint& pt); void operator +=(const MyPoint& pt); void Offset(int xOfs, int yOfs); int GetX(); int GetY(); };
Jun 15, 2001 (c) 2001 24MB Software Development 47
// a abstract base class for graphic shapes class Shape { protected: ColorType Color; MyPoint Position; public: Shape(MyPoint Pos, ColorType c) { Color = c; Position = Pos; } // method for drawing a given graphic shape void Draw(); };
48
Part I: Introduction
24
10/2/2001
Parameterized Classes
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Instances themselves are classes Also known as template Use for creating other classes based on the template Cannot directly use the instance creation mechanism Required parameters for instantiation
49
Example: Template
template<class T, int i> class MyStack { private: int MaxItem ; T* Top; T StackBuffer[i]; public: MyStack (); void Push(const T item); T& Pop(); }; template<class T, int i> MyStack<T, i> ::MyStack () { ... }; template<class T, int i> void MyStack<T, i>::Push(const T item) { ... }; // continue on next page...
50
Part I: Introduction
25
10/2/2001
template<class T, int i> T& MyStack <T, i>::Pop() { ... }; int main(int argc, char* argv[]) { MyStack <int , 5> stack; // a int stack MyStack <char, 10> stack2; // another char stack stack.Push(10); stack.Push(5); stack2.Push(s); int& n = stack.Pop(); char& c = stack2.Pop(); return 0; } // n = 5 // c = s
51
Used to define objects Items created using the class are called instances The term instance and object are used interchangeably Each instance requires its own set of data but shares the class operations
52
Part I: Introduction
26
10/2/2001
53
Learning Objectives
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
To provide a basic understanding of data abstraction Discuss the process of data encapsulation Distinguish between data encapsulation and data hiding Describe how encapsulation and data hiding can aid data protection
54
Part I: Introduction
27
10/2/2001
What Is Abstraction?
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Refers to how a given problem is represented in the system The detail implementations are hidden Dividing programs into logically separate units Breaking programs down into small ones
55
Data Abstraction
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Implemented by the use of classes The data cannot be accessed directly Access is provided through the permitted actions Provides for both primitive and userdefined data types Consists of two concepts:
Encapsulation Data hiding
56
Part I: Introduction
28
10/2/2001
Can be reused many times Makes programs more modular Simplifies complex programs Makes them more comprehensible Focus on the problem domain
57
Example: Abstraction
// a class for position class MyPoint { private : int x, y; public: MyPoint (); MyPoint(int x, int y); // omitted . . . }; // MyPoint class implementation is abstracted from Shape class point of vi ew class Shape { protected: MyPoint Position; // omitted . . . };
58
Part I: Introduction
29
10/2/2001
What Is Encapsulation?
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
The ability of an object to hide its internal data and methods The important parts of the object programmatically accessible via an interface The process of packaging an object's data together with its code
59
Each elements should be described together in the same syntactic unit Abstraction results in the hiding of details
60
Part I: Introduction
30
10/2/2001
The details of data structure remain unknown The details of legal actions for manipulating data are part of the definition
61
Protects the structure from random changes Ties together data and processes The data type is clearly defined Each variable is complete, stand-alone entity
62
Part I: Introduction
31
10/2/2001
Encapsulation
Adds to modularity Assists maintenance and debugging Makes programs more portable Produces a model that is closer to real life Facilitates data hiding and data protection
63
Example: Encapsulation
// information of a specific position on the screen and their op erations // are grouped (encapsulation) together in MyPoint class class MyPoint { private: int x, y; public: MyPoint (); MyPoint(int x, int y); // omitted . . . void Offset (int xOfs, int yOfs); int GetX(); int GetY(); };
64
Part I: Introduction
32
10/2/2001
Methods Messages
65
Learning Objectives
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Define the terms methods and messages Explain how methods and messages provide for communication Distinguish between method and message
66
Part I: Introduction
33
10/2/2001
What Is a Method?
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
An operation that can be used to manipulate an object Implemented in a piece of program code Used to describe the actions Perform certain tasks Implementation is not usually available to the class user Have full access to objects data
67
An object cannot directly access the methods of another object Must use a suitable message Only invoked by a message requesting It's useful to group the methods by their general task
68
Part I: Introduction
34
10/2/2001
69
What Is a Message?
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Messages and methods are synonymous Equivalent to function calls in a traditional environment Used by object to interact with each others Passing messages between objects is known as "method calling" Message can contain parameters Message parameters are actually method parameters
(c) 2001 24MB Software Development 70
Part I: Introduction
35
10/2/2001
The name of the receiving object The name of the method to be performed Any values, or parameters to carry out the action Any value returned by the method
71
Sending Messages
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Without having to know how the object works Need to know method's parameters A single message will give rise to different behaviors depending on receiving object
72
Part I: Introduction
36
10/2/2001
73
Learning Objectives
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Explain the interface Describe the principles of inheritance Describe how one class can inherit the characteristics of another Define the terms "polymorphism" and "dynamic binding Explain the concept of polymorphism
74
Part I: Introduction
37
10/2/2001
What Is an Interface?
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
The implementation of the abstraction The collection of messages that an object can process A binding contract between class itself and its consumer The consumer deal with an object via interfaces:
Public Inheritance Parameter
75
Interface Characteristics
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Associated with a particular class External section of an object Acts as an object's point of communication with other objects Describes the class's behavior and how to invoke this behavior Describes what the methods do, not how they do it
76
Part I: Introduction
38
10/2/2001
What Is Inheritance?
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
The ability to specify one class has a kind-of relationship with another class An object classification, which each object belong a given class Class hierarchy trees are known as inheritance trees Organized on the basis of common characteristics
77
The base class is parent, each subclass is a child The child class inherits all the properties of the parent class Child classes contain other characteristics additional to those inherited Child classes are more specialized than its parent
78
Part I: Introduction
39
10/2/2001
Child class can inherit properties from multiple parent class Used with care as problems can arise in certain cases
79
It facilitates code reuse It facilitates code maintenance It allows extensions to existing code
80
Part I: Introduction
40
10/2/2001
// a class for rectangle class Rectangle : public Shape { protected: int Width, Height; public: Rectangle(MyPoint Pos, int Width, int Height, ColorType Color); void Draw(); // draw a rectange, omitted . . . }; // a class for circle class Circle : public Shape { protected: int Radius; public: Circle (MyPoint Pos, int Radius, ColorType Color); void Draw(); // draw a circle, omitted . . . };
Jun 15, 2001 (c) 2001 24MB Software Development 81
// a class for square // Note: Square derived from Rectangle instead of Shape class Square : public Rectangle { public: Square(MyPoint Pos, int Width, ColorType Color); // omitted . . . }; // omitted . . .
82
Part I: Introduction
41
10/2/2001
83
What Is Polymorphism?
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
"Polymorphism" is meaning "having many parts The ability to extend system without modifying existing code Each class will respond in its own way to a single method The result is much the same
84
Part I: Introduction
42
10/2/2001
Polymorphism Characteristics
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
Base class's method can be individually tailored in each derived classes The method's name is same The method's actual code is different for each class Objects of related classes can respond to a generic method
85
Polymorphism Requirements
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
System must support dynamic binding "Binding" describes an association between two things Dynamic binding means that message is bound to the method at runtime
86
Part I: Introduction
43
10/2/2001
Less code needs to be designed and written Simply write generic code Code is more compact and cheaper to produce Code becomes more easily extendable
87
// without polymorphism // . . . // draw shapes Rectangle Rect(Point(10, 10), 50, 100, Magenta); Circle Cir(Point(200, 50), 30, Yellow); Square Squr(Point(100, 200), 75, Cyan); Rect.Draw(); Cir.Draw(); Squr.Draw (); // have to call the Draw method for individual object to // draw itshelf
88
Part I: Introduction
44
10/2/2001
// modify classes for using polymorphism class Shape { // omitted . . . virtual void Draw() = 0; // do nothing in Shape class, draw given // shape in derived classes }; class Rectangle : public Shape { // omitted . . . virtual void Draw(); }; class Circle : public Shape { // omitted . . . virtual void Draw(); };
Jun 15, 2001
// draw a rectangle
// draw a circle
89
// . . . // draw shapes Shape* Shp[0] Shp[1] Shp[2] Shp[3]; = new Rectangle(MyPoint(10, 15), 45, 70, Magenta); = new Circle(MyPoint(100, 100), 80, Yellow); = new Square(MyPoint(200, 110), 30, Cyan);
for (int i = 0; i < 3; ++ i) Shp[i]->Draw(); // the correct version Draw method of each object // is called // result
90
Part I: Introduction
45
10/2/2001
Access Control
Why This Course Course Outline Case Study Lesson Structure OO Paradigm Static Aspect Dynamic Aspect UML Rational Rose Patterns
91
Public actions for external accessing Private actions for only internal accessing Class containment, another private level layer of data protection
92
Part I: Introduction
46
10/2/2001
Conclusion
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
Relatively new approach aims to increase software development productivity Overcome many of the limitations of the procedural approach by reducing software complexity
93
Part I: Introduction
47
10/2/2001
What is Visual Modeling? Benefits of Visual Modeling What is UML? The Evolution of the UML UML Design Goals
95
Modeling captures essential parts of the system Dr. James Rumbaugh Visual Modeling is modeling using standard graphical notations
96
Part I: Introduction
48
10/2/2001
Captures Business Process Communication Tool Manages Complexity Defines Software Architecture Promotes Reuse
97
What is UML?
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
98
Part I: Introduction
49
10/2/2001
public feedback
Other methods
Booch
OMT
OOSE/Objectory
99
Ready to use, expressive modeling language Model core concepts Be independent of particular programming languages and development processes
100
Part I: Introduction
50
10/2/2001
Provide a formal basis for understanding, but not a lot of mathematical theory Can be tailored to meet specific needs Support higher-level development concepts
101
Static Model & Dynamic Model Stereotypes Model Elements Relationships UML Diagrams
102
Part I: Introduction
51
10/2/2001
Use Cases
Requirement Analysis Design Coding
Software System Component Diagram Deployment Diagram
Dynamic Model
Activity Diagram Sequence Diagram Collaboration Diagram State Diagram Code: Methods
Object Structure
Object Behavior
103
Static Model
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
Who acts Which Responsibilities With whom and about what Data types, data structure, relationships Who and What
104
Part I: Introduction
52
10/2/2001
Dynamic Model
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
105
106
Part I: Introduction
53
10/2/2001
Rational Rose is a graphical component modeling and development tool that uses the industry-standard Unified Modeling Language (UML) A Product of Rational Software Inc.
107
Increase developer productivity. Improve software quality. Common standard language results in improved team communication. Reverse-engineering capabilities allow you to integrate with legacy OO systems. Models and code remain synchronized through the development cycle.
108
Part I: Introduction
54
10/2/2001
Rose Modeler no language support Rose Professional support for 1 language Rose Enterprise supports multiple languages including (VC++, VB, Java, and CORBA)
109
110
Part I: Introduction
55
10/2/2001
111
You can create, display or modify Rose diagrams in the diagram window.
112
Part I: Introduction
56
10/2/2001
The Browser
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
The Rose browser is a hierarchical navigational tool allowing you to view the names and icons representing diagrams and model elements.
113
The documentation window allows you to create a self-documenting model and from that selfdocumenting model generate self-documenting code.
114
Part I: Introduction
57
10/2/2001
Views
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
Rational Rose is organized around the following views of a software project: Use Case Logical Component Deployment Each of these views presents a different aspect of the model
115
The Use -case view UseWhy This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Use-case View Logical View Component View Deployment View Patterns
Jun 15, 2001 (c) 2001 24MB Software Development 116
The use-case view helps you to understand and use the system. This view looks at how actors and use cases interact. The diagrams in this view are: Use-case diagrams Sequence diagrams Collaboration diagrams Activity diagrams
Part I: Introduction
58
10/2/2001
The Use -Case View UseWhy This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Use-case View Logical View Component View Deployment View Patterns
Jun 15, 2001 (c) 2001 24MB Software Development 117
The logical view addresses the functional requirements of the system. This view looks at classes and their relationships. The diagrams in this view are: Class diagrams State-chart diagrams
Part I: Introduction
59
10/2/2001
The component view addresses the software organization of the system. This view contains information about the software, executable and library components for the system. This view contains only component diagrams.
The deployment view shows the mapping of processes to hardware. This type of diagram is most useful in a distributed architecture environment where you might have applications and servers at different locations This view contains only one diagram the deployment diagram.
Part I: Introduction
60
10/2/2001
121
Patterns In OO - History
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
77 - Work of the architect Christopher Alexander 80s - Kent Beck playing with Smalltalk 91 - Gammas PhD thesis on ET++ 92 - Coads patterns paper 92 - Johnsons OOPSLA paper 93 - OOPSLA workshop Coad & Anderson 93 - Patterns discussion group on WWW 94 - First PLoP conference 95 - Gang of four book (first draft at OOPSLA 93)
Part I: Introduction
61
10/2/2001
Christopher Alexander
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
Alexander,C., Ishikawa, S. & Silverstein, M., A Pattern Language, Oxford University Press 1977 A handbook of patterns to be used in the construction Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice. 253 patterns in 35 groups
Each pattern is presented in the same format for clarity, ease of navigation etc.
Name. A Short descriptive phrase. Picture. Followed by an introductory paragraph to outline the context. Problem. An outline of the problem that the pattern aims to solve. Solution. The heart of the pattern, a description of how to solve the problem. Interconnections. The other patterns which are related to this one.
Part I: Introduction
62
10/2/2001
Coad, P.,Object-Oriented Patterns, Communications of the ACM Vol 35 No. 9 September 1992 "An object-oriented pattern is an abstraction of a doublet, triplet, or other small grouping of classes that is likely to be helpful again and again in objectoriented development." Coads patterns originally had a focus on OOA
Larman proposes a small set of (what he calls) patterns for assigning responsibilities to classes. General Responsibility Assignment Software Patterns. Expert, Creator, Low Coupling, High Cohesion, Polymorphism, Pure Fabrication, Indirection and Dont Talk to Strangers.
Part I: Introduction
63
10/2/2001
Grasp 1
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
Expert - assign the responsibility to the class that has the information necessary to fulfill the responsibility Creator - Assign B the responsibility to create an A if
B aggregates or contains A objects B records instances of A objects B closely uses A objects B has the initialising data that A needs (expert)
Low coupling - Assign a responsibility so that coupling remains low High cohesion - Assign a responsibility so that cohesion remains high
Grasp 2
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
Polymorphism - When behaviors vary by type, assign responsibilities (using polymorphism) to the type with the variation. Pure Fabrication - Invent a cohesive class which is not in the problem domain to further low coupling. Indirection - Assign the responsibility to an intermediate object to mediate between components so that they are not directly coupled. Dont talk to strangers - The Law of Demeter
Part I: Introduction
64
10/2/2001
Gang Of Four
Why This Course Course Outline Case Study Lesson Structure OO Paradigm UML Rational Rose Patterns
Gamma, E., Helm, R., Johnson, R., Vlissides, J., Design Patterns: Elements of Reusable Object-Oriented Software Addison-Wesley 1995. Work started with Gammas doctoral thesis and continued for a couple of years. The final published book shows signs of evolution from the earliest drafts. You should try to read chapter 2. There are 25 patterns arranged under 3 headings
129
Pattern Name and Classification Intent Also known as Motivation Applicability Structure
Participants Collaborations Consequences Implementation Sample code Known uses Related Patterns
Part I: Introduction
65
10/2/2001
Scope
Class Object
x y z
b a a b c c
Part I: Introduction
66
10/2/2001
The focus was never on component reuse but on the reuse of design ideas and insights. Patterns are increasingly becoming specialized to problem domains, apparently losing generality.
Important Message
134
Part I: Introduction
67
10/2/2001
135
136
Part I: Introduction
68
10/2/2001
137
Section Wrap-Up
138
Part I: Introduction
69
10/2/2001
Section Wrap-Up
Each student will offer one comment about:
What went well today What the class struggled with What should be changed
Time: 30 minutes
139
Part I: Introduction
70