Sie sind auf Seite 1von 62

OOAD & UML

Agenda

General Introduction
Object Oriented Software Development

General Introduction
Software Design

General Introduction
Object-Oriented Analysis 1/2

General Introduction
Object-Oriented Analysis 2/2

General Introduction
OMT & UML (OMT turned into UML)

General Introduction
What is UML?

Specifying

Visualizing

Constructing

Documenting

Business Modeling

Communications

General Introduction
OMT Stages & Models
p l h d n j b f o e u r s c i a t S Analysis - Model of real-world situation - What ? System Design - Overall architecture (sub-systems) Object Design - Refinement of Design - Algorithms/data structures to implement each class Implementation - Translation of object classes and relationships to a particular object-oriented language e m i t System ) m r g i d e a t s (

m y h f c e p s a l r t n o C ) m r g a i d t c e j b o ( l d o M t c e j b O l e d o M c i m a n y D ) s m r g i w o l f t a d (

i m o f s n r e u l v t a D e d M l a o i t c n u F

General Introduction
OO Analysis & Design Steps

Class Modeling

Class Modeling
What is an object?

Class Modeling
Abstraction

Abstract info

Class Modeling
Domain Analysis
Natural Language

Problem Domain

Class Modeling
Classes Identifying 1/2

instantiate instantiate instantiate

Class Modeling
Classes Identifying 2/2

Class Modeling
Classes, Attributes & Operations

Class
ball football baseball

Attributes
radius, weight air pressure liveness

Operations

catch, throw pass, kick, hand-off hit, pitch, ta

Class Modeling
Attributes

visibility name : type-expression = initial-value {property-string}

Class Modeling
Operations

name(parameter-list) return-type-expression

Class Modeling
Object Model Notation
Class Name
InstanceVariable1 InstanceVariable2: type
Method1() Method2(arguments) return type

Classes are represented as rectangles; The class name is at the top, followed by attributes (instance variables) and methods (operations) Depending on context some information can be hidden such as types or method arguments

(Class Name)
InstanceVariable1 = value InstanceVariable2: type
Method1() Method2(arguments) return type

Objects are represented as rounded rectangles; The objects name is its classname surrounded by parentheses Instance variables can display the values that they have been assigned; pointer types will often point (not shown) to the object being referenced

Class Modeling
Encapsulation

Class Modeling
Access modifiers

Class Modeling
Information Hiding

Class Modeling
Class Diagram
Name

Class diagrams show the classes of the system, their interrelationships (including inheritance, aggregation, and association), and the operations and attributes of the classes. Inheritance
Relations Associations Aggregation

Attributes Operations

Class Modeling
Inheritance

Class Modeling
OMT Inheritance Notation
Generalization Superclass Class Attributes Operations Ball Radius, Weight Throw, Catch

Subclasses Football air pressure pass, kick, hand-off Baseball liveness hit, pitch, tag Basketball air pressure , dimples shoot, dribble, pass

Specialization

Class Modeling
Multiple & Multilevel Inheritance

Class Modeling
Advantages of Inheritance

Class Modeling
Associations

Class Modeling
Associations & Cardinality
Class1 Exactly One (default) Zero or more Optional (zero or one) One or more Numerically specified * Association Name Class2 Class Class

0..1 Class 1.. * Class 1..5,8 Class

Class Modeling
Aggregation

Class Modeling
OMT Aggregation Notation
Window

TitleBar

ScrollBar

Border

Class Modeling
Multilevel Aggregation
Microcomputer

1+

Monitor

System box

Mouse

Keyboard

1+

1+

Chassis

CPU

RAM

Fan

Class Modeling
Abstract class 1/2

Class Modeling
Abstract class 2/2

animal *p = new animal();


public: pure virtual void init(); float time = round(((float) distance)/speed,2); cout<<It runs "<<distance<<miles in <<time<<hour. <<endl; return time; pure virtual void show() ;

animal p;

Class Modeling
Polymorphism

Class Modeling
Polymorphism - Overloading

Class Modeling
Polymorphism - Overriding

Class Modeling
Polymorphism Example 1/2

public: virtual void init() }

float time = round(((float) distance)/speed,2); cout<<It runs "<<distance<<miles in <<time<<hour. <<endl; return time; virtual void show() {}

Class Modeling
Polymorphism Example 2/2

} {

Dynamic Modeling

Dynamic Modeling
Dynamic Model Diagrams

Dynamic Modeling
Events & Scenarios

Dynamic Modeling
Event classes & attributes

Dynamic Modeling
An example scenario

Dynamic Modeling
OMT Event Trace Notation

Customer
select method of payment select credit insert card slide card through reader select grade select premium pump on

Pump

Credit Corp

verify account return approved

display unit cost, total cost, gallons dispensed pump gas update display with total cost, gallons dispensed charge total cost to account

Dynamic Modeling
Event Trace Example
Caller
caller lifts receiver dial tone begins dials (2) dial tone ends dials (7) dials (7) dials (6) ringing tone phone rings answers phone phones connected connection broken caller hangs up phones connected callee hangs up connection broken

Phone line

Callee

Dynamic Modeling
Event Trace ~ Sequence Diagram
Object: Class

Message Operations Lifeline

Dynamic Modeling
States & Transitions

Dynamic Modeling
State Machine Diagram

Functional Modeling
Hierarchical DFD

Functional Modeling
DFD Example: Office Supply
Employee DB verification Web Server input stream name/ password employee AccountDB verification account number order

validate employee

validate order

response (receipt)

Product DB verification order item validated order

Order DB order info order

process order

finalize order

response (receipt)

Add Operations to the Object Model

OMT: Four Phases

OMT: Four phases


1. System Design

OMT: Four phases


2. Object Design

OMT: Four phases


3. Detailed Design 1/2

OMT: Four phases


3. Detailed Design 2/2

OMT: Four phases


4. Implementation 1/2

OMT: Four phases


4. Implementation 2/2

OMT: Four Phases


Modularity Mechanisms

Das könnte Ihnen auch gefallen