object oriented design jerry kotubasyst39409- object oriented methodologies1

Post on 04-Jan-2016

259 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

SYST39409- Object Oriented Methodologies 1

Week 10Object Oriented Design

Jerry Kotuba

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

Design Models with Their Respective Input Models

3

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

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

6

Topics

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

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

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

9

Use Case Controller Pattern

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

11

Understanding Sequence Diagrams (SSDs)

12

Detailed Sequence Diagram

SYST39409- Object Oriented Methodologies 13

Restaurant Illustration

SSDDetailed Sequence

Jerry Kotuba

SYST39409- Object Oriented Methodologies 14

College Course Registration System

Register for Course Use Case

Jerry Kotuba

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

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

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?

18

SSD for Cancel an Order

19

First Cut Design Class Diagram for Cancel an Order

20

Potential Objects for Cancel an Order

21

First Cut Sequence Diagram for Cancel an Order

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

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

24

SSD for Create new phone order

25

First cut DCD for Create new phone order

26

Sequence Diagram for First Input Message

27

Sequence Diagram for First and Second Input Messages

28

Complete Sequence Diagram

29

Object-Oriented Three-Layer Program

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

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

Sample Design Class

32

Sample Java Class Definition

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

Standard Stereotypes Found in Design Models

35

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]

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

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.

SYST39409- Object Oriented Methodologies 39

ICE-08

Jerry Kotuba

SYST39409- Object Oriented Methodologies 40

Next Week

Sequence Diagrams continued…

Jerry Kotuba

top related