Com S 362: Object-Oriented Analysis and Design Interaction Diagrams and Responsibility Assignment Oct 23, 2006.

Slides:



Advertisements
Similar presentations
Introduction to Object Orientation System Analysis and Design
Advertisements

Object-Oriented Analysis and Design CHAPTER 17, 25: GRASP PATTERNS 1.
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Ch 12: Object-Oriented Analysis
SWE 4743 Strategy Patterns Richard Gesick. CSE Strategy Pattern the strategy pattern (also known as the policy pattern) is a software design.
Chapter 1 Object-Oriented System Development
© 2005 Prentice Hall8-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
NJIT More GRASP Patterns Chapter 22 Applying UML and Patterns Craig Larman Prepared By: Krishnendu Banerjee.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
Architectural Design Principles. Outline  Architectural level of design The design of the system in terms of components and connectors and their arrangements.
Object-Oriented Systems Analysis and Design Using UML
Com S 362: Object-Oriented Analysis and Design Class, Responsibilities, Collaborations, CRC Cards Com S 362: Object-Oriented Analysis and Design Oct 18,
Domain Modeling (with Objects). Motivation Programming classes teach – What an object is – How to create objects What is missing – Finding/determining.
CIT241 Prerequisite Knowledge ◦ Variables ◦ Operators ◦ C++ Syntax ◦ Program Structure ◦ Classes  Basic Structure of a class  Concept of Data Hiding.
Systems Analysis and Design in a Changing World, Fifth Edition
Object-Oriented Systems Analysis and Design Using UML
An Object-Oriented Approach to Programming Logic and Design
GRASP Principles. How to Design Objects The hard step: moving from analysis to design How to do it? –Design principles (Larman: “patterns”) – an attempt.
CIT241 Prerequisite Knowledge ◦ Variables ◦ Operators ◦ C++ Syntax ◦ Program Structure ◦ Classes  Basic Structure of a class  Concept of Data Hiding.
CS212: Object Oriented Analysis and Design Lecture 4: Objects and Classes - I.
1 Chapter 17 GRASP Design Patterns: Designing Objects with Responsibilities.
1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
Unified Modeling Language, Version 2.0
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Chapter 26 GoF Design Patterns. The Adapter Design Pattern.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
GRASP: Designing Objects With Responsibilities
17. GRASP—Designing Objects with Responsibilities III CSE5324 Lecture Quiz 17 due at 5 PM Thursday, 8 October 2015.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Chapter 17 GRASP: Designing Objects with Responsibilities. 1CS6359 Fall 2011 John Cole.
Design Patterns. Patterns “Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution.
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
Systems Analysis and Design in a Changing World, 3rd Edition
© 2005 Prentice Hall9-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
CSC 395 – Software Engineering Lecture 14: Object-Oriented Analysis –or– Ripping the Band-Aid Off Quickly.
IntellAgile Copyright © 2002 Craig Larman. All rights reserved. Object Design and Use- Case Realizations with GRASP Patterns.
Basic OOP Concepts and Terms. In this class, we will cover: Objects and examples of different object types Classes and how they relate to objects Object.
What to remember from Chap 13 (Logical architecture)
Lecture OO05 Object Scenarios Object Interaction Diagrams
A Student Guide to Object- Oriented Development Chapter 10 Designing objects and classes.
CIS 112 Exam Review. Exam Content 100 questions valued at 1 point each 100 questions valued at 1 point each 100 points total 100 points total 10 each.
Introduction to Classes and Objects. Real Life When a design engineer needs an electrical motor he doesn’t need to worry about –How a foundry will cast.
OO Methodology Elaboration Iteration 2 - Design Patterns -
Com S 362: Object-Oriented Analysis and Design Refactoring.
ITEC324 Principle of CS III Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
Com S 362: Object-Oriented Analysis and Design From Design To Code.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Copyright © Craig Larman All Rights Reserved COMP-350 Object-Oriented Analysis and Design GRASP: Designing Objects with Responsibilities Reference:
Chapter 17 Designing with Responsibilities. Fig
04 - OOD Intro.CSC4071 Software Design ‘Requirements’ defines –The goals the system needs to satisfy. ‘Specification’ defines –The externally-observable.
Chapter 11 An introduction to object-oriented design.
Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
General Principles in Assigning Responsibilities Responsibilities Responsibility-Driven Design CRC Cards GRASP.
11 Systems Analysis and Design in a Changing World, Fifth Edition.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
GRASP – Designing Objects with Responsibilities
CompSci 280 S Introduction to Software Development
The Movement To Objects
Conception OBJET GRASP Patterns
Apply Expert, Creator, Controller, Low Coupling, High Cohesion
Class Diagrams Oct 20, 2006.
The Object Oriented Approach to Design
From Design To Code Oct 25, 2006.
Interfaces.
Chapter 22 Object-Oriented Systems Analysis and Design and UML
GRASP.
Object Oriented System Design Responsibilities
Presentation transcript:

Com S 362: Object-Oriented Analysis and Design Interaction Diagrams and Responsibility Assignment Oct 23, 2006

Com S 362: Object-Oriented Analysis and Design 2 2 Recap: CRC Cards Process 1. Initial class list 2. Refined class list 3. while (More use case scenarios left) 4. do 5. Take a use case scenario 6. Assign responsibilities to classes 7. Find super- and sub-classes 8. Find collaborators 9. od

Com S 362: Object-Oriented Analysis and Design 3 3 Recap: Class Diagrams Class diagrams represent design structure Three parts: name, attribute, operations Visibility, attribute type, multiplicity Association, association multiplicity Generalization i.e. interface impl, subclassing Composition i.e. class A contains class B Applied information hiding, DSM, layering

Com S 362: Object-Oriented Analysis and Design 4 4 Today’s Lecture Interaction Diagrams Basics & Notations Responsibility Assignment Principles

Com S 362: Object-Oriented Analysis and Design 5 5 Example: Switch-Motor System Scenario: Motor can run, when the Switch state is on Class list: Switch and Motor R1: Store the decision condition R2: Make a decision R3: Run the motor

Com S 362: Object-Oriented Analysis and Design 6 6 Class Diagram View Switch -state:bool +getState():bool Motor -switch:Switch +run() 1 switch

Com S 362: Object-Oriented Analysis and Design 7 7 Interaction Diagram View :Motorswitch:Switch run getState Lifeline boxes state

Com S 362: Object-Oriented Analysis and Design 8 8 Switch-Motor: CRC Card View Scenario: Motor can run, when the Switch state is on Class list: Switch and Motor R1: Store the decision condition, R2: Make a decision, and R3: Run the motor Class Name: Switch Subclasses: Super classes: Responsibilities Collaborators Store decision condition Class Name: Motor Subclasses: Super classes: Responsibilities Collaborators Make a decision Switch Run the motor

Com S 362: Object-Oriented Analysis and Design 9 9 Class Diagram View Switch -state:bool +getState():bool Motor -switch:Switch +run():void 1 switch void run(){ if(switch.getState()){ /* Make a decision */ /* run the motor */ }

Com S 362: Object-Oriented Analysis and Design 10 Com S 362: Object-Oriented Analysis and Design 10 Impact of Change: Multi-State Switch Switch -state:bool +getState():bool Motor -switch:Switch +run():void 1 switch void run(){ if(switch.getState()){ /* Make a decision */ /* run the motor */ } -state:int +getState():int Change: Switch can have more than two states.

Com S 362: Object-Oriented Analysis and Design 11 Com S 362: Object-Oriented Analysis and Design 11 Change Escapes Module Boundary Switch -state:bool +getState():bool Motor -switch:Switch +run():void 1 switch void run(){ if(switch.getState()){ /* Make a decision */ /* run the motor */ } Change: Switch can have more than two states. -state:int +getState():int Impact of Change

Com S 362: Object-Oriented Analysis and Design 12 Com S 362: Object-Oriented Analysis and Design 12 Information Expert Which class has the necessary information? Example – class list: Switch and Motor R1: Store the decision condition, R2: Make a decision, and R3: Run the motor Class Name: Switch Subclasses: Super classes: Responsibilities Collaborators Store decision Condition Make a decision Class Name: Motor Subclasses: Super classes: Responsibilities Collaborators Run the motor Switch

Com S 362: Object-Oriented Analysis and Design 13 Com S 362: Object-Oriented Analysis and Design 13 Improved Class Diagram View Switch -state:bool +isOn():bool Motor -switch:Switch +run():void 1 switch void run(){ if(switch.isOn()){ /* run the motor */ }

Com S 362: Object-Oriented Analysis and Design 14 Com S 362: Object-Oriented Analysis and Design 14 Implementation Changes Encapsulated Switch -state:bool +isOn():bool Motor -switch:Switch +run():void 1 switch void run(){ if(switch.isOn()){ /* run the motor */ } Change: Switch can have more than two states. -state:int +isOn():bool Remember: Information Hiding

Com S 362: Object-Oriented Analysis and Design 15 Com S 362: Object-Oriented Analysis and Design 15 Example: User-Level Process Management Main scenario: A process will maintain necessary information for it to run such as program counter (PC), reference to program segment (.ps), reference to data segments (.ds), registers (regs) Scenario of interest: functionality to create an identical copy of a process should be provided Class list: process, client R1: store information PC,.ps,.ds. Regs R2: create copy of process

Com S 362: Object-Oriented Analysis and Design 16 Com S 362: Object-Oriented Analysis and Design 16 User-Level Process Management : CRC Card View Class list: process, client R1: store information pc,.ps,.ds. regs R2: create copy of process Class Name: Process Subclasses: Super classes: Responsibilities Collaborators Store information pc,.ps,.ds. regs Class Name: Client … Subclasses: Super classes: Responsibilities Collaborators Create copy Process of.pc,.ps,.ds,.regs Spawn another process

Com S 362: Object-Oriented Analysis and Design 17 Com S 362: Object-Oriented Analysis and Design 17 Change: Register-based to Stack-based Machine Class list: process, client R1: store information pc,.stack,.top,.ps,.ds. R2: create copy of process Class Name: Process Subclasses: Super classes: Responsibilities Collaborators Store information pc,.stack,.top,.ds. regs Class Name: Client … Subclasses: Super classes: Responsibilities Collaborators Create copy Process of.pc,.ps,.ds,.regs Spawn another process Impact on all clients

Com S 362: Object-Oriented Analysis and Design 18 Com S 362: Object-Oriented Analysis and Design 18 Creator: Which class has the initializing data? Class list: process, client R1: store information pc,.ps,.ds. regs R2: create copy of process Class Name: Process Subclasses: Super classes: Responsibilities Collaborators Store information pc,.ps,.ds. regs Create copy of.pc,.ps,.ds,. regs and spawn another process Class Name: Client … Subclasses: Super classes: Responsibilities Collaborators Process Change Impact Encap- sulated

Com S 362: Object-Oriented Analysis and Design 19 Com S 362: Object-Oriented Analysis and Design 19 Adding GUI to the Sorting Application Integers (>0) Sorting Algorithm Sorting Application Merge Sort Sort : User Which class should handle the Sort Event? Class Name: UI Subclasses: Super classes: Responsibilities Collaborators Handle Sort SortingApp Event Class Name: SortingApp Subclasses: Super classes: Responsibilities Collaborators Create sorting, ISort, IStorage storage instance etc.

Com S 362: Object-Oriented Analysis and Design 20 Com S 362: Object-Oriented Analysis and Design 20 Adding GUI to the Sorting Application SortButton … /addActionListener(ActionListener l) javax.swing.DefaultButtonModel … +addActionListener(ActionListener l) SortingApplication storage:IStorage sort:ISort +sort(…):IStorage /actionPerformed(ActionEvent e) java.awt.event.ActionListener … +actionPerformed(ActionEvent e)

Com S 362: Object-Oriented Analysis and Design 21 Com S 362: Object-Oriented Analysis and Design 21 Summary Interaction Diagrams Responsibility Assignment Principles Information Expert Creator Controller Polymorphism Pure Fabrication Indirection Protected Variations

Com S 362: Object-Oriented Analysis and Design 22 Com S 362: Object-Oriented Analysis and Design 22