Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 1 Class Design and Evaluation Class.

Slides:



Advertisements
Similar presentations
Use cases Use-cases are a scenario based technique in the UML which identify the actors in an interaction and which describe the interaction itself A set.
Advertisements

A Brief Introduction. Acknowledgements  The material in this tutorial is based in part on: Concurrency: State Models & Java Programming, by Jeff Magee.
Object-Oriented Analysis and Design
Chapter 15: System Modeling with UML
Introduction To System Analysis and Design
SE 555 Software Requirements & Specification1 Use-Case Modeling: Overview and Context.
Reasons to study concepts of PL
Chapter 1 Software Development. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 1-2 Chapter Objectives Discuss the goals of software development.
1 Real-time requirements  Intro to Software Engineering  Software Development Process Models  Formal methods in software specification  Structured.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
Objectives The key roles an architecture description plays in a software project. The key roles an architecture description plays in a software project.
© Copyright Eliyahu Brutman Programming Techniques Course.
UML Sequence Diagrams Eileen Kraemer CSE 335 Michigan State University.
1 Business Models Modeling. 2 Why Model the Business Business modeling is a technique to help answer critical questions, such as: What do the workers.
Domain Modeling (with Objects). Motivation Programming classes teach – What an object is – How to create objects What is missing – Finding/determining.
UML Sequence Diagrams Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 1 Designing the Classes Once.
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
K. Jamroendararasame*, T. Matsuzaki, T. Suzuki, and T. Tokuda Department of Computer Science, Tokyo Institute of Technology, JAPAN Two Generators of Secure.
SOFTWARE ENGINEERING BIT-8 APRIL, 16,2008 Introduction to UML.
Controlling Inheritance Data Structures & OO Development I 1 Computer Science Dept Va Tech May 2006 ©2006 McQuain & Ribbens Inheritance Modes When deriving.
Things and Relations - Examples Things Relationships Structural Behavioral Grouping Annotational Dependency Association Generalization Realization Class,
SE513 Software Quality Control Lecture01: Introduction to Software Quality Assurance Galin, SQA from Theory to Education Limited.
Architecture styles Pipes and filters Object-oriented design Implicit invocation Layering Repositories.
Chapter 5 Evaluating Class Designs. Class Design: Perspectives specification Behavioral Structural Information Section 9.2:
Presented by: CHAN LAI SAN ( ) REBAH DAW SARREB ( ) FIDA AL-OBAISI ( ) 08 April 2008 (Tuesday 6pm – 7:30pm)
UML Diagrams: Class Diagrams The Static Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Smith’s Aerospace © P. Bailey & K. Vander Linden, 2005 Architecture: Component and Deployment Diagrams Patrick Bailey Keith Vander Linden Calvin College.
Programming in Java Unit 3. Learning outcome:  LO2:Be able to design Java solutions  LO3:Be able to implement Java solutions Assessment criteria: 
Software Project Management
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.
Lecture 3 Uses Cases Topics UML Use Cases pop quiz Readings: Chapter 3 January 24, 2008 CSCE 492 Software Engineering.
CS 4310: Software Engineering Lecture 4 System Modeling The Analysis Stage.
Modeling Shari L. Pfleeger and Joanne M. Atlee, Software Engineering: Theory and Practice, 4 th edition, Prentice Hall, Hans Van Vliet, Software.
Cohesion and Coupling CS 4311
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Chapter 10 Analysis and Design Discipline. 2 Purpose The purpose is to translate the requirements into a specification that describes how to implement.
GRASP: Designing Objects with Responsibilities
OHT 1.1 Galin, SQA from theory to implementation © Pearson Education Limited 2004 The uniqueness of software quality assurance The environments for which.
Software Engineering Prof. Ing. Ivo Vondrak, CSc. Dept. of Computer Science Technical University of Ostrava
The Static Analysis Model Class Diagrams Prof. Hany H. Ammar, CSEE, WVU, and Dept. of Computer Science, Faculty of Computers and Information, Cairo University.
1 CMPT 275 Software Engineering Requirements Analysis Phase Requirements Analysis activity Janice Regan,
The System and Software Development Process Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Chapter 1 Introduction to Software Engineering. Why Engineer Software? n Air traffic control case study –$2.3 Billion spent without any usable deliverable.
The Unified Modeling Language Part II Omar Meqdadi SE 2730 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Design? !… When it needs? To understand, to communicate with customers Complex problem What is good design? Separate What to do?(Policy) and How to do(mechanism)
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Identifying Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 1 Getting Started In the.
Communication OO Software Design and Construction Computer Science Dept Va Tech February 2001 ©2001 McQuain WD & Keller BJ 1 Communicating Objects Think.
Chapter 91 Object-Oriented Design. Chapter 92 Topics zClass Design zClass Hierarchy Design zDesigning Complex Logic zDesign Representations zDesign Patterns.
C++ Inheritance Data Structures & OO Development I 1 Computer Science Dept Va Tech June 2007 © McQuain Generalization versus Abstraction Abstraction:simplify.
Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping.
1 ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #1.
1 Using const in C++ Classes In the presence of pointers we must take steps to ensure the integrity of the object Can use const method definitions The.
1 BTS330 Visual Modeling. What is Visual Modeling? 2 Copyright © 1997 by Rational Software Corporation Computer System Business Process Order Item Ship.
Modeling Shari L. Pfleeger and Joanne M. Atlee, Software Engineering: Theory and Practice, 4 th edition, Prentice Hall, Hans Van Vliet, Software.
Composition OO Software Design and Construction Computer Science Dept Va Tech January 2000 ©2000 McQuain WD 1 Composition: Cooperating Classes Composition.
Kyung Hee University Class Diagramming Notation OOSD 담당조교 석사과정 이정환.
Use Case Diagram Example
UML Diagrams: Class Diagrams The Static Analysis Model
Design Class Diagrams
Unified Modeling Language
Complexity Time: 2 Hours.
Unified Modeling Language
Modeling Shari L. Pfleeger and Joanne M. Atlee, Software Engineering: Theory and Practice, 4th edition, Prentice Hall, Hans Van Vliet, Software Engineering:
Object oriented analysis and design
Copyright 2007 Oxford Consulting, Ltd
Design Strategies in OO Development
CS 2704 Object Oriented Software Design and Construction
Software Engineering Basics
Presentation transcript:

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 1 Class Design and Evaluation Class Design: Perspectives Example: Library System Behavioral Perspective Behavioral Categories Structural Perspective Structural Categories Informational Perspective Data Versus State Evaluating a Class Design Tests for Adequacy of Abstraction Good or Bad Abstractions? Tests for Adequacy of Responsibilities Tests for Adequacy of Interface Example of Poor Naming Tests for Adequacy of Usage Revised Location Class Implementation

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 2 Class Design: Perspectives specification Behavioral Structural Informational Emphasizes actions in system Emphasizes relationships among components Emphasizes role of information/data/state and how it’s manipulated

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 3 Example: Library System Behavioral (actions): – Patrons are registered – Books are checked out Structural (relationships): – Catalog is made of books – Book may be checked out to a patron Informational (state): – What’s the status (available, checked out, ???) of a book? – What books does a patron have checked out?

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 4 Behavioral Perspective Consider some action in a program… What object... – initiates action? What objects... – help perform action? – are changed by action? – are interrogated during action? Consider registering a patron… Controller (procedural)... – initiates the action Circulation Desk… – performs the action Patron List… – is changed by the action Patron List… – is interrogated during the action

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 5 Behavioral Categories Actor (does something) Circulation Desk Reactor (system events, external & user events) Controller, Parser?? Agent(messenger, server, finder, communicator) Catalog, PatronList Transformer(data formatter, data filter) Parser

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 6 Structural Perspective What objects... – are involved in relationship? – are necessary to sustain (implement, realize, maintain) relationship? What objects not in relationship... – are aware of and exploit relationship? Consider a relationship: book is checked out to patron Circulation Desk… – is involved in the relationship Catalog and PatronList… – are necessary to sustain the relationship ???... – is aware of and exploits the relationship

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 7 Structural Categories Acquaintance(symmetric, asymmetric) – CirculationDesk knows about PatronList, asymmetric relationship Containment(collaborator, controller) – CirculationDesk controls/uses PatronList and Catalog Collection(peer, iterator, coordinator) – PatronList contains and manages Patrons – CirculationDesk contains and manages CheckedOut objects

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 8 Informational Perspective What objects... – represent the data or state? – read data or interrogate state? – write data or update state? Consider a state: status of book CheckedOut list and Catalog implicitly… – represent (stores) the state information CirculationDesk… – interrogates the state of a book (via …) CirculationDesk… – updates the state of a book

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 9 Data Versus State Definition: Information processed by the system Example: checkout command Data State Definition: Information used by system to control processing Example: BookStatus (Avail, CheckedOut, etc.)

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 10 Evaluating a Class Design Evaluation is needed to accept, revise or reject a class design. Five aspects to be evaluated: – Abstraction: useful? – Responsibilities: reasonable? – Interface: clean, simple? – Usage:“right” set of methods? – Implementation:reasonable?

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 11 Tests for Adequacy of Abstraction Identity: Are class purpose and method purposes well-defined and connected? Clarity: Can purpose of class be given in brief, dictionary-style definition? Uniformity: Do operations have uniform level of abstraction?

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 12 Good or Bad Abstractions? class Date: Date represents a specific instant in time, with millisecond precision. class TimeZone: TimeZone represents a time zone offset, and also figures out daylight savings.

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 13 Tests for Adequacy of Responsibilities Clear: Does class have specific responsibilities? Limited: Do responsibilities fit the abstraction (no more/less)? Coherent: Do responsibilities make sense as a whole? Complete: Does class completely capture abstraction?

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 14 Tests for Adequacy of Interface Naming: Do names clearly express the intended effect? Symmetry: Are names and effects of pairs of inverse operations clear? Flexibility: Are methods adequately overloaded? Convenience: Are default values used when possible?

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 15 Example of Poor Naming class ItemList { private: //... public: void Delete(Item item); // Take Item’s node out of list and delete Item void Remove(Item item); // Take Item’s node out of the list but do not // delete Item void Erase(Item item); // Keep Item’s node in List, but with no information };

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 16 Tests for Adequacy of Usage Examine how objects of the class are used in different contexts (see below…) Incorporate all operations that may be useful in these contexts… up to a point… class Location { private: int xCoord, yCoord; //coordinates public: Location(int x, int y); int xCoord(); //return xCoord value int yCoord(); //return yCoord value }; // usage: Location point(100,100); // shift point: point = Location( point.xCoord()+5, point.yCoord()+10 );

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 17 class Location { private: int xCoord, yCoord; //coordinates public: Location(int x, int y); int XCoord(); //return xCoord value int YCoord(); //return yCoord value void ShiftBy(int dx, int dy); // shift by relative coordinates }; // Revised usage: Location point(100,100); point.ShiftBy(5, 10); // shift point Revised Location Class

Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 18 Implementation Least important, mostly easily changed aspect to be evaluated. – poorly engineered design leads to problematic implementation – massaging a problematic implementation (without redesign) rarely produces any effective improvement – it’s only code… Overly complex implementation may mean: – class is not well conceived – class has been given too much responsibility