object oriented design jerry kotubasyst39409- object oriented methodologies1

40
Week 10 Object Oriented Design Jerry Kotuba SYST39409- Object Oriented Methodologies 1

Upload: scott-dickerson

Post on 04-Jan-2016

241 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

SYST39409- Object Oriented Methodologies 1

Week 10Object Oriented Design

Jerry Kotuba

Page 2: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

SYST39409- Object Oriented Methodologies 2

Agenda

Recap SSDs ICE-07 Take up

Schedule Today

Finalize SSD’s – Message notation Sequence Diagrams - Part I

Jerry Kotuba

Page 3: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

Design Models with Their Respective Input Models

3

Page 4: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

Learning Objectives

Explain the purpose and objectives of object-oriented design

Develop design class diagrams

Develop Sequence Diagrams

Learn the importance of “low” coupling and “high” cohesion in design

Explain the fundamental principles of object-oriented design

4

Page 5: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

OO Design—The Bridge Between Analysis and Programming Bridge between users’ requirements and

new system’s programming

Object-oriented design is process by which detailed object-oriented models are built

Programmers use design to write code and test new system

User interface, network, controls, security, and database require design tasks and models

5

Page 6: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

6

Topics

Design Patterns and the Use Case Controller Use Case Realization Designing with Sequence Diagrams Object Responsibility Three-Layer Design Design Patterns

Page 7: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

7

Design Patterns and the Use Case Controller

Design patternA standard solution template to a design requirement that facilitates the use of good design principles

Use case controller patternDesign requirement is to identify which problem domain class should receive input messages from the user interface for a use case

Page 8: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

8

Design Patterns and the Use Case Controller (continued)

Solution is to choose a class to serve as a collection point for all incoming messages for the use case. Controller acts as intermediary between outside world and internal system

Artifact – a class invented by a system designer to handle a needed system function, such as a controller class

Page 9: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

9

Use Case Controller Pattern

Page 10: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

10

Use Case Realization with Sequence Diagrams

Realization of use case done through interaction diagram development

Determine what objects collaborate by sending messages to each other to carry out use case

Sequence diagrams and communication diagrams represent results of design decisions

Use well-established design principles such as coupling, cohesion, separation of responsibilities

Page 11: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

11

Understanding Sequence Diagrams (SSDs)

Page 12: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

12

Detailed Sequence Diagram

Page 13: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

SYST39409- Object Oriented Methodologies 13

Restaurant Illustration

SSDDetailed Sequence

Jerry Kotuba

Page 14: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

SYST39409- Object Oriented Methodologies 14

College Course Registration System

Register for Course Use Case

Jerry Kotuba

Page 15: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

15

Designing with Sequence Diagrams

Sequence diagrams used to explain object interactions and document design decisions

Document inputs to and outputs from system for single use case or scenario

Capture interactions between system and external world as represented by actors

Inputs are messages from actor to system Outputs are return messages showing data

Page 16: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

16

Object Responsibility

Objects are responsible for system processing Responsibilities include knowing and doing

Knowing about object’s own data and other classes of objects with which it collaborates to carry out use cases

Doing activities to assist in execution of use case

Receive and process messages

Instantiate, or create, new objects required to complete use case

Design means assigning responsibility to the appropriate classes based on design principles and using design patterns

Page 17: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

17

First-Cut Sequence Diagram

Start with elements from SSD Replace :System object with use case

controller Add other objects to be included in use

caseSelect input message from the use caseAdd all objects that must collaborate

Determine other messages to be sent Which object is source and destination of each message?

Page 18: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

18

SSD for Cancel an Order

Page 19: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

19

First Cut Design Class Diagram for Cancel an Order

Page 20: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

20

Potential Objects for Cancel an Order

Page 21: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

21

First Cut Sequence Diagram for Cancel an Order

Page 22: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

22

Guidelines for Sequence Diagram Development for Use Case

Take each input message and determine internal messages that result from that input

For that message, determine its objectiveNeeded information, class destination, class source, and objects created as a resultDouble check for all required classes

Flesh out components for each messageIteration, guard-condition, passed parameters, return values

Page 23: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

23

Assumptions About First-Cut Sequence Diagram

Perfect technology assumption

Don’t include system controls like login/logout (yet)

Perfect memory assumption

Don’t worry about object persistence (yet)

Assume objects are in memory ready to work Perfect solution assumption

Don’t worry about exception conditions (yet)

Assume happy path/no problems solution

Page 24: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

24

SSD for Create new phone order

Page 25: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

25

First cut DCD for Create new phone order

Page 26: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

26

Sequence Diagram for First Input Message

Page 27: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

27

Sequence Diagram for First and Second Input Messages

Page 28: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

28

Complete Sequence Diagram

Page 29: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

29

Object-Oriented Three-Layer Program

Page 30: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

Object-Oriented Design Processes and Models

Diagrams developed for analysis/requirements Use case diagrams, use case descriptions

and activity diagrams, domain model class diagrams, and system sequence diagrams

Diagrams developed for design Component diagrams and Deployment

diagrams Interaction diagrams and package

diagrams Design class diagrams

30

Page 31: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

Fundamental Principles of Object-oriented Detailed Design Design class diagrams and detailed sequence

diagrams Use each other as inputs and are developed in

parallel

Sequence diagrams define the interactions between objects in order to execute a use case. Interactions are called messages Correspond to method calls in

programming language Design Classes show attributes and method

signatures

Page 32: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

Sample Design Class

32

Page 33: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

Sample Java Class Definition

Page 34: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

Design Class Symbols

UML does not distinguish between design class notation and domain model notation

Domain model class diagram shows conceptual classes in users’ work environment

Design class diagram specifically defines software classes

UML uses stereotype notation to categorize a model element by its characteristics

34

Page 35: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

Standard Stereotypes Found in Design Models

35

Page 36: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

SYST39409-Object Oriented Methodologies 36

A:Customer Library:System

4 Loan detail Confi rmation

3 Confirms Borrowed Title

2 Reservation Details

1 Provides Membership ID

Illustration Exercise[1]

Page 37: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

SYST39409-Object Oriented Methodologies 37

Illustration Exercise[2]

Book Copy on Loan

<<entity>>Undergrad Student

<<entity>>Grad Student

<<entity>>Faculty Patron

<<entity>>Library Patron

<<entity>>Reservation

<<entity>>Loan

<<entity>>Book Copy

<<entity>>Book T itle

has 1..*

1..*

makes

1

1..*

makes

1

1..*

becomes

0..*

0..1

has

1

1..*

specifies 1

1

A:Customer Library:System

4 Loan detail Confi rmation

3 Confirms Borrowed Title

2 Reservation Details

1 Provides Membership ID

Use Case – Check-out Book

S.S.D.

Domain Class Diagram

Page 38: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

SYST39409-Object Oriented Methodologies 38

Class Responsibilities Collaborating classes with return data

Library Patron Create a reservationCreate a loan

[Reservation] (ID)[Loan] (ID)

Reservation Identify Book title [Book Title] (Title details)

Loan Identify Book title [Book Title] (Title details)

Book Title Identify Book Copy Number [BookCopy] (ID)

BookCopy

Think of responsibilities as “Requests” to do something.

Page 39: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

SYST39409- Object Oriented Methodologies 39

ICE-08

Jerry Kotuba

Page 40: Object Oriented Design Jerry KotubaSYST39409- Object Oriented Methodologies1

SYST39409- Object Oriented Methodologies 40

Next Week

Sequence Diagrams continued…

Jerry Kotuba