LECTURE 7: Object Oriented Design. 2 Topics Assigning Responsibilities to Objects Design Principles Expert Doer High Cohesion Low Coupling Business Policies.

Slides:



Advertisements
Similar presentations
ANALYSIS MODEL. Analysis Model Actual system development start with this. Aims to structure the system independently of the actual implementation environment.
Advertisements

Interaction Design: Visio
LECTURE 3: Requirements Engineering
CPSC 333: Foundations of Software EngineeringJ. Denzinger 2.2. Use Cases: Scenario based requirements modeling Recommended: Booch, Rumbaugh, Jacobson:
Describing Process Specifications and Structured Decisions Systems Analysis and Design, 7e Kendall & Kendall 9 © 2008 Pearson Prentice Hall.
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
Use Case Modeling SJTU. Unified Modeling Language (UML) l Standardized notation for object-oriented development l Needs to be used with an analysis and.
Chapter 7 – Object-Oriented Design
Ivan Marsic Rutgers University LECTURE 7: Object Oriented Design.
CS3773 Software Engineering Lecture 03 UML Use Cases.
Use Case Diagram © copyright 2001 SNU OOPSLA Lab..
Object-Oriented Analysis and Design
Chapter 9 Describing Process Specifications and Structured Decisions
Use Case Modeling Written by: Zvika Gutterman Adam Carmi.
Software Engineering I Object-Oriented Design
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
Low Coupling High Cohesion
UML Sequence Diagrams Eileen Kraemer CSE 335 Michigan State University.
An Introduction to Rational Rose Real-Time
Object-Oriented Analysis and Design
UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.
UML Sequence Diagrams Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
State and Sequence Diagrams Modelling dynamic information So far we have seen: Use Case Diagrams – requirements capture, interface.
The Design Discipline.
Quiz 1. Who is the guru of Extreme Programming?
Why Analysis Process Refer to earlier chapters Models what the system will do makes it easier for understanding no environment considered (hence, system.
UML Unified Markup Language Ziya Karakaya Atılım University, Computer Engineering
Imperative Programming
GRASP Principles. How to Design Objects The hard step: moving from analysis to design How to do it? –Design principles (Larman: “patterns”) – an attempt.
Ivan Marsic Rutgers University LECTURE 6: Domain Modeling.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
Architecture GRASP Realization of use cases in interaction diagrams Design class diagram Design ( how )
High-Level Design With Sequence Diagrams COMP314 (based on original slides by Mark Hall)
Describing Process Specifications and Structured Decisions Systems Analysis and Design, 7e Kendall & Kendall 9 © 2008 Pearson Prentice Hall.
Selection Control Structures Simple Program Design Third Edition A Step-by-Step Approach 4.
1 Analysis Extracting from Use Cases to Create Diagrams.
Relational Databases and Transaction Design Lecture 27.
Selection Control Structures. Simple Program Design, Fourth Edition Chapter 4 2 Objectives In this chapter you will be able to: Elaborate on the uses.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 05. Review Software design methods Design Paradigms Typical Design Trade-offs.
GRASP: Designing Objects with Responsibilities
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
© 2005 Prentice Hall9-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
Yarmouk University Department of Computer Information Systems CIS 499 Yarmouk University Department of Computer Information Systems CIS 499 Yarmouk University.
Use Cases Use Cases are employed to describe the functionality or behavior of a system. Each use case describes a different capability that the system.
Example: object diagram for Scheduler, v What is wrong with this diagram? Seems like a lot of similarity between Task and UnplannedTask Can use.
1 Graph Coverage (6). Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Section
ITEC324 Principle of CS III Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
CS212: Object Oriented Analysis and Design Lecture 32: Use case and Class diagrams.
Dynamic Models Sequence Diagrams Collaboration Diagrams Activity Diagrams.
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
UML - Development Process 1 Software Development Process Using UML.
Object and Class Structuring Chapter 9 Part of Analysis Modeling Designing Concurrent, Distributed, and Real-Time Applications with UML Hassan Gomaa (2001)
Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
1 Object-Oriented Static Modeling of the Banking System - III Lecture # 33.
LECTURE 5: Use Cases Ivan Marsic Rutgers University.
LECTURE 5: Use Cases Ivan Marsic Rutgers University.
Instructor: Dr. Hany H. Ammar
LECTURE 5: Use Cases Ivan Marsic Rutgers University.
CMPE 280 Web UI Design and Development August 29 Class Meeting
Use Case Modeling - II Lecture # 27.
LECTURE 3: Requirements Engineering
LECTURE 6: Domain Modeling
LECTURE 7: Object Oriented Design
LECTURE 7: Object Oriented Design
LECTURE 6: Domain Modeling
Chapter 11 Describing Process Specifications and Structured Decisions
LECTURE 9: Object Oriented Design
LECTURE 5: Use Cases Ivan Marsic Rutgers University.
LECTURE 3: Requirements Engineering
ITEC324 Principle of CS III
Presentation transcript:

LECTURE 7: Object Oriented Design

2 Topics Assigning Responsibilities to Objects Design Principles Expert Doer High Cohesion Low Coupling Business Policies Class Diagram

3 select function(“unlock") : System User «initiating actor» prompt for the key enter key verify key signal: valid key, lock open open the lock, turn on the light Timer «offstage actor» start ("duration“) System Sequence Diagrams considered interactions between the actors We already worked with interaction diagrams: System Sequence Diagrams System Sequence Diagrams

4 Design: Object Interactions System Sequence Diagrams considered interactions between the actors Object Sequence Diagrams consider interactions between the objects System Sequence Diagram Design Sequence Diagram

5 Metaphor for Software Design: “Connecting the Dots” We start with objects/concepts from the Domain Model and modify or introduce new objects, as needed to make the system function work.

6 Types of Object Responsibilities Knowing responsibility: Memorizing data or references, such as data values, data collections, or references to other objects, represented as a property Doing responsibility: Performing computations, such as data processing, control of physical devices, etc., represented as a method Communicating responsibility: Communicating with other objects, represented as message sending (method invocation)

7 Design: Assigning Responsibilities (a)(b)

8 Characteristics of Good Designs Short communication chains between the objects Balanced workload across the objects Low degree of connectivity (associations) among the objects method_1() method_2() … method_N() method_1()

9 Design Principles Expert Doer Principle: that who knows should do the task High Cohesion Principle: do not take on too many computation responsibilities Low Coupling Principle: do not take on too many communication responsibilities There are many more …

10 Design: Assigning Responsibilities (a)(b) Although the Checker is the first to acquire the information about the key validity, we decide to assign the responsibility to notify the LockCtrl to the Controller. This is because the Controller would need to know this information anyway—to inform the user about the outcome of the key validity checking. In this way we maintain the Checker focused on its specialty and avoid assigning too many responsibilities to it.

11 Cohesion

12 Responsibility-Driven Design 1.Identify the responsibilities domain modeling provides a starting point some will be missed at first and identified in subsequent iterations 2.For each responsibility, identify the alternative assignments –if the choice appears to be unique then move to the next responsibility 3.Consider the merits and tradeoffs of each alternative by applying the design principles –select what you consider the “optimal” choice 4.Document the process by which you arrived to each responsibility assignment

13 UC-4: View Access Log

14 Example … Communicating responsibilities identified for the system function “enter key”: Responsibility Description Send message to Key Checker to validate the key entered by the user. Send message to DeviceCtrl to disarm the lock device. Send message to DeviceCtrl to switch the light bulb on. Send message to PhotoObserver to report whether daylight is sensed. Send message to DeviceCtrl to sound the alarm bell.

15 Unlocking Sequence Diagram sk = stored key; the process either terminates by matching a stored key or exhausting the key store. Key is a dynamic object, unlike others which are static contains keycode, name, other forms of ID, timestamp, door ID, … -- disposed of after checking

16 Unlock Use Case

17 Unlock Seq. Diag. Variation 1 To avoid an impression that the above design is the only one possible!! Sets a boolean attribute of the Key object: ok = true/false; Business logic (IF-THEN rule) relocated from Controller to LockCtrl

18 Unlock Seq. Diag. Variations 2&3 Depends on which solution you consider more elegant; It is helpful that checkIfDaylightAndIfNotThenSetLit() is named informatively (reveals the intention), but the knowledge encoded in the name of the method is imparted onto the caller.

19 Summary of Design Variations

20 Business Policies IF key  ValidKeys THEN disarm lock and turn lights on ELSE increment failed-attempts-counter IF failed-attempts-counter equals maximum number allowed THEN block further attempts and raise alarm Should be moved into a separate object: Make them explicit part of the model Confine the future changes in business policies

21 Class Diagram

22 Traceability Matrix (3) Mapping: Domain model to Class diagram

23 Types of Object Communication A A B B P P S2S2 S2S2 S1S1 S1S1 SNSN SNSN A A B B (a)(b)(c)