70
OOAD With UML And Rational Rose 10/2/2001 Part I: Introduction 1 Jun 15, 2001 (c) 2001 24MB Software Development Object Object- Oriented Analysis & Design Oriented Analysis & Design Visual Modeling with UML And Rational Rose 2000® Part I. Introduction Jun 15, 2001 (c) 2001 24MB Software Development 2 Sharing Your Objectives Sharing Your Objectives Individually state: Your name Your company affiliation You job title and responsibilities What you hope to get from this course Less than 15 minutes

OOAD Introduction

  • Upload
    nam-vu

  • View
    335

  • Download
    5

Embed Size (px)

Citation preview

Page 1: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 1

Jun 15, 2001 (c) 2001 24MB Software Development

ObjectObject--Oriented Analysis & DesignOriented Analysis & DesignVisual Modeling with UML And Rational Rose 2000®Part I. Introduction

Jun 15, 2001 (c) 2001 24MB Software Development 2

Sharing Your ObjectivesSharing Your Objectives

Individually state:Your nameYour company affiliationYou job title and responsibilitiesWhat you hope to get from this course

Less than 15 minutes

Page 2: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 2

Jun 15, 2001 (c) 2001 24MB Software Development 3

Why This Course?Why This Course? (Or Design Problem)(Or Design Problem)

Everyone knows about how important design work isVery few people really do design before codingConsequence:

Messy applicationsInability of maintenance and upgradesMany reworks

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 4

PurposePurpose

By the end of this course, you should be able to:

Complete OO design sessions effectivelyKnow how to start effectively in every stage of development process fully focusing on customers

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 3: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 3

Jun 15, 2001 (c) 2001 24MB Software Development 5

Purpose…Purpose…

And…Know how we should apply design & architectural patterns effectivelyUsing Rational Rose ® & UML for visual modeling work

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 6

Think custom

ers!T

hink customers!

A R

eal-world Project

Putting it all together

Contents MapContents Map

I. IntroductionAll projects start with customers needs! Where do I start from?

I. IntroductionAll projects start with customers needs! Where do I start from?

II. Requirement CapturingGoal-driven Use-Cases. A system view from users

II. Requirement CapturingGoal-driven Use-Cases. A system view from users

IV. AnalysisSystem view from the inside. What shall we have in the system.

IV. AnalysisSystem view from the inside. What shall we have in the system.

V. DesignBlue-print for implementation. How the system will work. Patterns again.

V. DesignBlue-print for implementation. How the system will work. Patterns again.

III. ArchitectureThink architecture first. All start from patterns. Subtractix approach.

III. ArchitectureThink architecture first. All start from patterns. Subtractix approach.

VI. More About Patterns & Design RefinementArchitectural Patterns, Design Heuristics, and so on…

VI. More About Patterns & Design RefinementArchitectural Patterns, Design Heuristics, and so on…

Page 4: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 4

Jun 15, 2001 (c) 2001 24MB Software Development 7

Part I. IntroductionPart I. Introduction

Overview of the course:OO Paradigm OverviewUML OverviewRational Rose OverviewPattern Overview

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 8

Module I: OO Paradigm OverviewModule I: OO Paradigm Overview

Why OO?Better modeling for the real world

Goals: Understanding ofBasic concepts and elements of OO paradigmInteraction mechanism of the OO worldBenefits of OO methodology

GuidelinesActivities and labsConclusion

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 5: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 5

Jun 15, 2001 (c) 2001 24MB Software Development 9

Module II: UML OverviewModule II: UML Overview

Why UML?Standardized, powerful language for Visual Modeling and just a language

Goals: Understanding ofPurpose of UMLBasic concepts of the languageClassification of UML diagrams and when to apply them during development process

Activities and labs

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 10

Module III: Rational Rose OverviewModule III: Rational Rose Overview

Why Rational Rose?Rose is almost the best Visual Modeling tool

Goals:Understanding and using the notations of Rose effectivelyAbility to use Rose for visual modeling works

Guidelines: Focus on: “When the modeling work is done?”

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 6: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 6

Jun 15, 2001 (c) 2001 24MB Software Development 11

Module IV: Patterns OverviewModule IV: Patterns Overview

What is pattern?Why Patterns?

Patterns are, and will play a very important role in software development. However, patterns are not silver bullet.

Learning goals:Understanding what’s a patternAbility to apply patterns in design works

Techniques:GRASP patterns

GOF patternsPOSA patterns

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 12

Part II. Requirements 1/2Part II. Requirements 1/2

Why doing requirements captures?A system view from customers

Learning Goals:Understanding of how important requirement capturing isUnderstand Use-cases – The modern form of requirements for a customer centric development processAbility of describing customer requirements using Use-cases

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 7: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 7

Jun 15, 2001 (c) 2001 24MB Software Development 13

Part II. Requirements 2/2Part II. Requirements 2/2

What to be done?How to capture requirements?Modeling techniquesGuidelinesUsing use-cases patterns

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 14

Part III. Architecture 1/2Part III. Architecture 1/2

What to do with Architecture?Think architecture first and think big. Subtraction always be easier than addition

Learning Goals:Understand about software architecture and architectural patternsAbility to use architectural patterns and Subtractix approach in design works

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 8: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 8

Jun 15, 2001 (c) 2001 24MB Software Development 15

Part III. Architecture 2/2Part III. Architecture 2/2

How:Architectural analysisArchitectural designRefining architectureAnalysis: Architecture refinement – WhatDesign: Architecture refinement – How

Architectural patterns and Subtractix

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 16

Part IV. Analysis 1/2Part IV. Analysis 1/2

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

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 9: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 9

Jun 15, 2001 (c) 2001 24MB Software Development 17

Part IV. Analysis 2/2Part IV. Analysis 2/2

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 modelGuidelinesUsing analysis patterns

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 18

Part V. Design 1/2Part V. Design 1/2

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.

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 10: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 10

Jun 15, 2001 (c) 2001 24MB Software Development 19

Part V. Design 2/2Part V. Design 2/2

How to design?Modeling TechniquesGuidelines:

Development environment dependencyPrinciples for design refinements

Using design patterns

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 20

Part VI. Patterns & Design RefinementPart VI. Patterns & Design Refinement

Architectural & Design patterns reviewAdditional design principles and heuristics

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 11: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 11

Jun 15, 2001 (c) 2001 24MB Software Development 21

A Sample Project: POS Of Classics Inc.A Sample Project: POS Of Classics Inc.

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.

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 22

Lesson StructureLesson Structure

Lessons start with goalsGoals are divided into:

What should be doneHow can we achieve the “What”

Lessons are supported with guidelinesand techniquesDuring lessons, students have to exercise with activities and labs to re-enforce learned knowledge

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 12: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 12

Jun 15, 2001 (c) 2001 24MB Software Development 23

Module I: OO Paradigm & ConceptsModule I: OO Paradigm & Concepts

Jun 15, 2001 (c) 2001 24MB Software Development 24

Learning GoalsLearning Goals

By the end of this module, you will be able to understand:

Basic concepts/elements of OO ParadigmDynamic aspect inside the OO worldBenefits of OO paradigm or advantages of OO over traditional methods

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 13: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 13

Jun 15, 2001 (c) 2001 24MB Software Development 25

More Detailed, We Will Learn AboutMore Detailed, We Will Learn About

Static AspectObjects and classesAbstraction and encapsulation

Dynamic AspectMethods and messagesInterfaces, inheritance, and polymorphismAccess control

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 26

Objects and ClassesObjects and Classes

OO software developmentObjectsClasses

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 14: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 14

Jun 15, 2001 (c) 2001 24MB Software Development 27

Learning ObjectivesLearning Objectives

Introducing the object-oriented principlesOutline the limitations associated with the traditional approach and the ways to improve Explain the concept of the object and classDescribe the role of objects and classesDescribe the way in which classes handle data

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 28

Basic Founded Concepts of OOBasic Founded Concepts of OO

Abstraction and encapsulation (and data hiding)InheritancePolymorphism and dynamic binding

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 15: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 15

Jun 15, 2001 (c) 2001 24MB Software Development 29

The Principles OO Aimed toThe Principles OO Aimed to

Support the principles of good programmingProvide software of high-qualityFulfill user expectationsMake code more portable and more reliableReduce development costsMake code better represent real-world objects

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 30

The Principles of Good ProgrammingThe Principles of Good Programming

ModularityReusabilityExtensibilityEase of maintenancePreservation of data integrityEfficient debugging

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 16: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 16

Jun 15, 2001 (c) 2001 24MB Software Development 31

Problems With Traditional ApproachProblems With Traditional Approach

Difficult or not as effective at:Attain and maintain efficientlyInteraction between modulesModeling real-world thingsDeveloping complex software

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 32

The Ways To Improve 1/2The Ways To Improve 1/2

Express all problems domain entities through the concept of objectsModel the real-world better than othersFocus specifically on the problems and not be mired in the detailsPromoting to reuse previous workAllows to extend or enhance your system without modifying or breaking existing code

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 17: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 17

Jun 15, 2001 (c) 2001 24MB Software Development 33

The Ways To Improve… 2/2The Ways To Improve… 2/2

Simplifying complex problems by:Emphasizes "black box" functionsEmbraces structured developmentEncourages better programming design

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 34

What Is An Object?What Is An Object?

Objects are a natural thing to modelCan be identified, classified, and definedRepresented in a systemHas a set of attributes that describe itAttribute is something that is internal to an object

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 18: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 18

Jun 15, 2001 (c) 2001 24MB Software Development 35

ExampleExample

Circle, rectangle, square… are objectsYellow, purple, cyan are their attributesAll of them belong to a group of object: shape objects

cyan squarecyan square

purple rectanglepurple rectangleyellow circleyellow circle

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 36

Everything Is An ObjectEverything Is An Object

Each objects can represent:EntitiesRolesData structures

Express all problem domain entitiesComprise data and the methods work on that data

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 19: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 19

Jun 15, 2001 (c) 2001 24MB Software Development 37

Apply To RealApply To Real--world Objectsworld Objects

Create an accurate representation of the problem domainMap this representation into the final programModularizes information as well as processing

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 38

Object RelationshipsObject Relationships

AssociationAggregationSpecialization

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 20: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 20

Jun 15, 2001 (c) 2001 24MB Software Development 39

AssociationAssociation

Semantic connection between objectsAllows one object to know about the public attributes & operations of another object

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 40

AggregationAggregation

Stronger form of associationThe relationship between a whole and its partsOne object may have several aggregation relationships with other objects

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 21: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 21

Jun 15, 2001 (c) 2001 24MB Software Development 41

SpecializationSpecialization

An inheritance relationship between two objectsAllows one object to inherit the attributes of another

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 42

What Is a Class?What Is a Class?

Think as simply a type that has associated methodsDefine both the data and the operation on that dataA blueprint for objects that share a similar structure or behaviorA blueprint for a given set of functionality

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 22: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 22

Jun 15, 2001 (c) 2001 24MB Software Development 43

How Is a Class Defined?How Is a Class Defined?

Its dataThe operations that may be performed on itThe operations that it may perform on other classes

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 44

Class Characteristics 1/3Class Characteristics 1/3

Each class is a syntactical unitIndependent stand-alone modules"Decoupled" from each other

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 23: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 23

Jun 15, 2001 (c) 2001 24MB Software Development 45

Class Characteristics… 2/3Class Characteristics… 2/3

May contain another class as its data membersContainment is not confined to a single levelAccess to the contained classes is strictly controlledThe contained class is private

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 46

Class Characteristics... 3/3Class Characteristics... 3/3

Can be organized into class hierarchiesClass hierarchies show relationship between classesClass hierarchies are usually represented as an inverted treeThe top of the hierarchy is known as the rootRoot is the source of the shared characteristics

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 24: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 24

Jun 15, 2001 (c) 2001 24MB Software Development 47

Example: A point classExample: A point class

class MyPoint{private:

int x, y;

public:MyPoint();MyPoint(int x, int y);

// copy constructorMyPoint(MyPoint& pt);

// operatorsvoid 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 48

Example: A shape classExample: A shape class

// 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 shapevoid Draw();

};

Page 25: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 25

Jun 15, 2001 (c) 2001 24MB Software Development 49

Parameterized ClassesParameterized Classes

Instances themselves are classesAlso known as templateUse for creating other classes based on the templateCannot directly use the instance creation mechanismRequired parameters for instantiation

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 50

Example: TemplateExample: 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...

Page 26: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 26

Jun 15, 2001 (c) 2001 24MB Software Development 51

Example: Template… Cont’dExample: Template… Cont’d

template<class T, int i> T& MyStack<T, i>::Pop(){ ... };

int main(int argc, char* argv[]){

MyStack<int, 5> stack; // a int stackMyStack<char, 10> stack2; // another char stack

stack.Push(10);stack.Push(5);

stack2.Push(‘s’);

int& n = stack.Pop(); // n = 5char& c = stack2.Pop(); // c = ‘s’

return 0;}

Jun 15, 2001 (c) 2001 24MB Software Development 52

Classes Vs. ObjectsClasses Vs. Objects

Used to define objectsItems created using the class are called instancesThe term instance and object are used interchangeablyEach instance requires its own set of data but shares the class operations

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 27: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 27

Jun 15, 2001 (c) 2001 24MB Software Development 53

Abstraction and EncapsulationAbstraction and Encapsulation

Data abstractionEncapsulation

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 54

Learning ObjectivesLearning Objectives

To provide a basic understanding of data abstractionDiscuss the process of data encapsulationDistinguish between data encapsulation and data hidingDescribe how encapsulation and data hiding can aid data protection

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 28: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 28

Jun 15, 2001 (c) 2001 24MB Software Development 55

What Is Abstraction?What Is Abstraction?

Refers to how a given problem is represented in the systemThe detail implementations are hiddenDividing programs into logically separate unitsBreaking programs down into small ones

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 56

Data AbstractionData Abstraction

Implemented by the use of classesThe data cannot be accessed directlyAccess is provided through the permitted actionsProvides for both primitive and user-defined data typesConsists of two concepts:

EncapsulationData hiding

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 29: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 29

Jun 15, 2001 (c) 2001 24MB Software Development 57

Benefits of Good AbstractionBenefits of Good Abstraction

Can be reused many timesMakes programs more modularSimplifies complex programsMakes them more comprehensibleFocus on the problem domain

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 58

Example: AbstractionExample: Abstraction

// a class for positionclass MyPoint{private :

int x, y;public:

MyPoint();MyPoint(int x, int y);// omitted . . .

};

// MyPoint class implementation is abstracted from Shape class point of viewclass Shape{protected:

MyPoint Position;// omitted . . .

};

Page 30: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 30

Jun 15, 2001 (c) 2001 24MB Software Development 59

What Is Encapsulation?What Is Encapsulation?

The ability of an object to hide its internal data and methodsThe important parts of the object programmatically accessible via an interfaceThe process of packaging an object's data together with its code

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 60

The Concept of EncapsulationThe Concept of Encapsulation

Abstract data types consist of:The data and how it is structuredThe set of actions that may operate on the data

Each elements should be described together in the same syntactic unitAbstraction results in the hiding of details

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 31: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 31

Jun 15, 2001 (c) 2001 24MB Software Development 61

The Concept of Data HidingThe Concept of Data Hiding

The details of data structure remain unknownThe details of legal actions for manipulating data are part of the definition

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 62

More About EncapsulationMore About Encapsulation

Protects the structure from random changesTies together data and processesThe data type is clearly definedEach variable is complete, stand-alone entity

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 32: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 32

Jun 15, 2001 (c) 2001 24MB Software Development 63

The Advantage of EncapsulationThe Advantage of Encapsulation

As a result of data hidingPrograms are more reliableThe integrity of data is preserved

EncapsulationAdds to modularityAssists maintenance and debuggingMakes programs more portableProduces a model that is closer to real lifeFacilitates data hiding and data protection

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 64

Example: EncapsulationExample: Encapsulation

// information of a specific position on the screen and their operations// 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();

};

Page 33: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 33

Jun 15, 2001 (c) 2001 24MB Software Development 65

Methods and MessagesMethods and Messages

MethodsMessages

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 66

Learning ObjectivesLearning Objectives

Define the terms “methods” and “messages”Explain how methods and messages provide for communicationDistinguish between method and message

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 34: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 34

Jun 15, 2001 (c) 2001 24MB Software Development 67

What Is a Method?What Is a Method?

An operation that can be used to manipulate an objectImplemented in a piece of program codeUsed to describe the actionsPerform certain tasksImplementation is not usually available to the class userHave full access to object’s data

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 68

More About MethodMore About Method

An object cannot directly access the methods of another objectMust use a suitable messageOnly invoked by a message requestingIt's useful to group the methods by their general task

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 35: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 35

Jun 15, 2001 (c) 2001 24MB Software Development 69

The Groupings of MethodsThe Groupings of Methods

It can be useful to give names to the groupings of methods:

Object managersData managersImplementersHelpers

Two benefits of method grouping:Makes clear how the objects behaveEnsure that the class definition is complete

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 70

What Is a Message?What Is a Message?

Messages and methods are synonymousEquivalent to function calls in a traditional environmentUsed by object to interact with each othersPassing messages between objects is known as "method calling"Message can contain parametersMessage parameters are actually method parameters

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 36: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 36

Jun 15, 2001 (c) 2001 24MB Software Development 71

The Components of a MessageThe Components of a Message

The name of the receiving objectThe name of the method to be performedAny values, or parameters to carry out the actionAny value returned by the method

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 72

Sending MessagesSending Messages

Without having to know how the object worksNeed to know method's parametersA single message will give rise to different behaviors depending on receiving object

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 37: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 37

Jun 15, 2001 (c) 2001 24MB Software Development 73

Interfaces, Inheritance, and PolymorphismInterfaces, Inheritance, and Polymorphism

InterfacesInheritancePolymorphism

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 74

Learning ObjectivesLearning Objectives

Explain the interfaceDescribe the principles of inheritanceDescribe how one class can inherit the characteristics of anotherDefine the terms "polymorphism" and "dynamic binding“Explain the concept of polymorphism

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 38: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 38

Jun 15, 2001 (c) 2001 24MB Software Development 75

What Is an Interface?What Is an Interface?

The implementation of the abstractionThe collection of messages that an object can processA binding contract between class itself and its consumerThe consumer deal with an object via interfaces:

PublicInheritanceParameter

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 76

Interface CharacteristicsInterface Characteristics

Associated with a particular classExternal section of an objectActs as an object's point of communication with other objectsDescribes the class's behavior and how to invoke this behaviorDescribes what the methods do, not how they do it

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 39: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 39

Jun 15, 2001 (c) 2001 24MB Software Development 77

What Is Inheritance?What Is Inheritance?

The ability to specify one class has a kind-of relationship with another classAn object classification, which each object belong a given classClass hierarchy trees are known as inheritance treesOrganized on the basis of common characteristics

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 78

How the Inheritance Tree Is Structured?How the Inheritance Tree Is Structured?

The base class is parent, each subclass is a childThe child class inherits all the properties of the parent classChild classes contain other characteristics additional to those inheritedChild classes are more specialized than its parent

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 40: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 40

Jun 15, 2001 (c) 2001 24MB Software Development 79

Support Multiple InheritanceSupport Multiple Inheritance

Child class can inherit properties from multiple parent classUsed with care as problems can arise in certain cases

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 80

Summaries Benefits of InheritanceSummaries Benefits of Inheritance

It facilitates code reuseIt facilitates code maintenanceIt allows extensions to existing code

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 41: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 41

Jun 15, 2001 (c) 2001 24MB Software Development 81

Example: Inheritance 1/3Example: Inheritance 1/3

// a class for rectangleclass 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 circleclass 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 82

Example: Inheritance 2/3Example: Inheritance 2/3

// 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 . . .

Page 42: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 42

Jun 15, 2001 (c) 2001 24MB Software Development 83

Example: Inheritance 3/3Example: Inheritance 3/3

Shape

Rectangle

Square

Circle

Class inheritance tree

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 84

What Is Polymorphism?What Is Polymorphism?

"Polymorphism" is meaning "having many parts”The ability to extend system without modifying existing codeEach class will respond in its own way to a single methodThe result is much the same

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 43: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 43

Jun 15, 2001 (c) 2001 24MB Software Development 85

Polymorphism CharacteristicsPolymorphism Characteristics

Base class's method can be individually tailored in each derived classesThe method's name is sameThe method's actual code is different for each classObjects of related classes can respond to a generic method

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 86

Polymorphism RequirementsPolymorphism Requirements

System must support dynamic binding"Binding" describes an association between two thingsDynamic binding means that message is bound to the method at runtime

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 44: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 44

Jun 15, 2001 (c) 2001 24MB Software Development 87

Benefits of Using PolymorphismBenefits of Using Polymorphism

Less code needs to be designed and writtenSimply write generic codeCode is more compact and cheaper to produceCode becomes more easily extendable

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 88

Example: Polymorphism 1/3Example: Polymorphism 1/3

// 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(); // have to call the Draw method for individual object toCir.Draw(); // draw itshelfSqur.Draw();

Page 45: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 45

Jun 15, 2001 (c) 2001 24MB Software Development 89

Example: Polymorphism 2/3Example: Polymorphism 2/3

// modify classes for using polymorphismclass 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(); // draw a rectangle

};

class Circle : public Shape{

// omitted . . .virtual void Draw(); // draw a circle

};

Jun 15, 2001 (c) 2001 24MB Software Development 90

// . . .// draw shapes

Shape* Shp[3];Shp[0] = new Rectangle(MyPoint(10, 15), 45, 70, Magenta);Shp[1] = new Circle(MyPoint(100, 100), 80, Yellow);Shp[2] = 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

Example: Polymorphism 3/3Example: Polymorphism 3/3

Page 46: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 46

Jun 15, 2001 (c) 2001 24MB Software Development 91

Access ControlAccess Control

To preserve data integrity:Access must be as restricted as possibleData can defend itself against attack

Two types of access must be defined:Access to the dataAccess to the actions

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 92

Types of Access ControlTypes of Access Control

Two levels of data type access be defined:

PrivatePublic

Public actions for external accessingPrivate actions for only internal accessingClass containment, another private level layer of data protection

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

Static Aspect

Dynamic Aspect

UML

Rational Rose

Patterns

Page 47: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 47

Jun 15, 2001 (c) 2001 24MB Software Development 93

ConclusionConclusion

Relatively new approach aims to increase software development productivityOvercome many of the limitations of the procedural approach by reducing software complexity

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 94

Module II: UML OverviewModule II: UML Overview

A picture is worth a thousand words

Page 48: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 48

Jun 15, 2001 (c) 2001 24MB Software Development 95

Introducing Visual Modeling & UMLIntroducing Visual Modeling & UML

What is Visual Modeling?Benefits of Visual ModelingWhat is UML?The Evolution of the UMLUML Design Goals

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 96

What is Visual Modeling?What is Visual Modeling?

“Modeling captures essential parts of the system” – Dr. James RumbaughVisual Modeling is modeling using standard graphical notations

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 49: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 49

Jun 15, 2001 (c) 2001 24MB Software Development 97

Why Visual Modeling?Why Visual Modeling?

Captures Business ProcessCommunication ToolManages ComplexityDefines Software ArchitecturePromotes Reuse

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 98

What is UML?What is UML?

Visual language for modeling a systemModels for

SpecificationArchitecture DesignImplementation

Systems of several different kindsSoftware systemsBusiness processes

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 50: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 50

Jun 15, 2001 (c) 2001 24MB Software Development 99

The Evolution of the UMLThe Evolution of the UML

Booch

Unified Method 0.8

UML 1.0

OMT OOSE/Objectory

UML 0.9

OOPSLA ´95

WWW - June ´96

Beta version OOPSLA ´96Submission to OMG, Jan ´97

Documentation Set

WWW Spec only

Other methods

publicfeedback

UML 1.1Submission to OMG, Sept ‘97OMG Vote, Oct ‘97

UML 1.3Jun, ‘99

Jun 15, 2001 (c) 2001 24MB Software Development 100

UML Design GoalsUML Design Goals

Ready to use, expressive modeling languageModel core conceptsBe independent of particular programming languages and development processes

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 51: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 51

Jun 15, 2001 (c) 2001 24MB Software Development 101

UML Design Goals… Cont’dUML Design Goals… Cont’d

Provide a formal basis for understanding, but not a lot of mathematical theoryCan be tailored to meet specific needsSupport higher-level development concepts

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 102

Exploring the UML NotationExploring the UML Notation

Static Model & Dynamic ModelStereotypesModel ElementsRelationshipsUML Diagrams

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 52: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 52

Jun 15, 2001 (c) 2001 24MB Software Development 103

Static Model & Dynamic ModelStatic Model & Dynamic Model

Requirement

Analysis

Design

Coding

Static Model Dynamic Model

Use Case Diagram

Analysis-Class DiagramPackage Diagram

Design-Class Diagram

Code: Class DiagramClass Definition

Object Structure Object Behavior

Sequence Diagram

Collaboration DiagramState Diagram

Code: Methods

Use Cases

Software SystemComponent DiagramDeployment Diagram

Activity Diagram

Jun 15, 2001 (c) 2001 24MB Software Development 104

Static ModelStatic Model

Who actsWhich ResponsibilitiesWith whom and about what

ØData types, data structure, relationships ØWho and What

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 53: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 53

Jun 15, 2001 (c) 2001 24MB Software Development 105

Dynamic ModelDynamic Model

How objects interact?Sequencing of interaction

ØHow and When

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 106

Module III: Rational Rose Module III: Rational Rose –– An OverviewAn Overview

Page 54: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 54

Jun 15, 2001 (c) 2001 24MB Software Development 107

What is Rational Rose?What is Rational Rose?

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.

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 108

Why should I use Rational Rose?Why should I use Rational Rose?

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.

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 55: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 55

Jun 15, 2001 (c) 2001 24MB Software Development 109

Rational Rose EditionsRational Rose Editions

Rose Modeler – no language supportRose Professional – support for 1 languageRose Enterprise – supports multiple languages including (VC++, VB, Java, and CORBA)

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 110

Graphical User InterfaceGraphical User Interface

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 56: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 56

Jun 15, 2001 (c) 2001 24MB Software Development 111

Toolbar and Tool boxesToolbar and Tool boxes

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 112

The Diagram WindowThe Diagram Window

You can create, display or modify Rose diagrams in the diagram window.

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 57: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 57

Jun 15, 2001 (c) 2001 24MB Software Development 113

The BrowserThe Browser

The Rose browser is a hierarchical navigational tool allowing you to view the names and icons representing diagrams and model elements.

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 114

The Documentation WindowThe Documentation Window

The documentation window allows you to create a self-documenting model and from that self-documenting model generate self-documenting code.

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 58: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 58

Jun 15, 2001 (c) 2001 24MB Software Development 115

ViewsViews

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

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 116

The UseThe Use--case viewcase view

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 diagramsSequence diagrams Collaboration diagramsActivity diagrams

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Use-case View

Logical View

Component View

Deployment View

Patterns

Page 59: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 59

Jun 15, 2001 (c) 2001 24MB Software Development 117

The UseThe Use--Case ViewCase View

Why 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 118

The Logical ViewThe Logical View

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 diagramsState-chart diagrams

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Use-case View

Logical View

Component View

Deployment View

Patterns

Page 60: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 60

Jun 15, 2001 (c) 2001 24MB Software Development 119

The Component ViewThe Component View

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.

Why 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 120

The Deployment ViewThe Deployment View

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.

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Use-case View

Logical View

Component View

Deployment View

Patterns

Page 61: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 61

Jun 15, 2001 (c) 2001 24MB Software Development 121

Module IV: PatternsModule IV: Patterns

Patterns In OO Patterns In OO -- HistoryHistory

77 - Work of the architect Christopher Alexander80s - Kent Beck playing with Smalltalk91 - Gamma’s PhD thesis on ET++92 - Coad’s patterns paper92 - Johnson’s OOPSLA paper93 - OOPSLA workshop Coad & Anderson93 - Patterns discussion group on WWW94 - First PLoP conference95 - Gang of four book (first draft at OOPSLA 93)

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 62: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 62

Christopher AlexanderChristopher Alexander

Alexander,C., Ishikawa, S. & Silverstein, M., A Pattern Language, Oxford University Press 1977A 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

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

The Structure Of A PatternThe Structure Of A Pattern

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.

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 63: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 63

Peter Peter Coad’sCoad’s PatternsPatterns

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 object-oriented development."

Coad’s patterns originally had a focus on OOA

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Larman’s GRASP patternsLarman’s GRASP patterns

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 Don’t Talk to Strangers.

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 64: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 64

Grasp 1Grasp 1

Expert - assign the responsibility to the class that has the information necessary to fulfill the responsibilityCreator - Assign B the responsibility to create an A if

B aggregates or contains A objectsB records instances of A objectsB closely uses A objectsB has the initialising data that A needs (expert)

Low coupling - Assign a responsibility so that coupling remains lowHigh cohesion - Assign a responsibility so that cohesion remains high

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Grasp 2Grasp 2

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.Don’t talk to strangers - The Law of Demeter

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 65: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 65

Jun 15, 2001 (c) 2001 24MB Software Development 129

Gang Of FourGang Of Four

Gamma, E., Helm, R., Johnson, R., Vlissides, J., Design Patterns: Elements of Reusable Object-Oriented Software Addison-Wesley 1995.Work started with Gamma’s 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

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Gang Of Four Gang Of Four -- FormatFormat

Pattern Name and ClassificationIntentAlso known asMotivationApplicabilityStructure

Participants CollaborationsConsequencesImplementationSample codeKnown usesRelated Patterns

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Page 66: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 66

Design Pattern SpaceDesign Pattern Space

Factory Method

Abstract FactoryBuilderPrototypeSingleton

Adapter (class)

Adapter (object)BridgeCompositeDecoratorFacadeFlyweightProxy

InterpreterTemplate MethodChain of ResponsibilityCommandIteratorMediatorMementoObserverStateStrategyVisitor

Creational Structural Behavioral

Purpose

Scope Class

Object

Observer Pattern OutlineObserver Pattern Outline

a b cx 60 30 10y 50 30 20z 80 10 10 a b c

abc

a = 50%b = 30%c = 20%

Change notification

requests, modifications

Page 67: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 67

Patterns And ReusePatterns And Reuse

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.

Why This Course

Course Outline

Case Study

Lesson Structure

OO Paradigm

UML

Rational Rose

Patterns

Jun 15, 2001 (c) 2001 24MB Software Development 134

Important MessageImportant Message

Page 68: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 68

Jun 15, 2001 (c) 2001 24MB Software Development 135

So What Customers Really Want?So What Customers Really Want?

Business users: drive revenue, improve efficiency

Find and access information needed –searchUnderstand what’s important – in contextTie things together – relationshipGet organized – workflowLink to my business processes –integration

Jun 15, 2001 (c) 2001 24MB Software Development 136

What Customers Want…?What Customers Want…?

Developers: reduce development cost and cycle time

Deal with expanding data sources –integrated APIBuild application quickly – objects, visual builders

Page 69: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 69

Jun 15, 2001 (c) 2001 24MB Software Development 137

Where Should I Start From?Where Should I Start From?

Never start from scratch (If it’s possible)Start with patterns – patterns are everywhere:

Business patternsCustomers needs patternsArchitectural patternsAnalysis patternsDesign patternsImplementation patterns

Jun 15, 2001 (c) 2001 24MB Software Development 138

Section WrapSection Wrap--UpUp

Page 70: OOAD Introduction

OOAD With UML And Rational Rose 10/2/2001

Part I: Introduction 70

Jun 15, 2001 (c) 2001 24MB Software Development 139

Section WrapSection Wrap--UpUp

Each student will offer one comment about:

What went well todayWhat the class struggled withWhat should be changed

Time: 30 minutes