Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 1 Designing the Classes Once.

Slides:



Advertisements
Similar presentations
Research Issues in Web Services CS 4244 Lecture Zaki Malik Department of Computer Science Virginia Tech
Advertisements

Ch4: Software Architecture and Design. 1 Object-oriented paradigm  Object-oriented decomposition:  Agents comprised of two parts:  Hidden implementation:
Use Case & Use Case Diagram
OOAD Using the UML - Use-Case Analysis, v 4.2 Copyright  Rational Software, all rights reserved 1/18 Use Case Analysis – continued Control Classes.
Object-Oriented Analysis and Design
Introduction To System Analysis and Design
Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.
6/8/991 Analysis Tuesday 09/14/99 Revised: September 11, 2000 (APM)
Software Configuration Management (SCM)
Use Case Analysis – continued
Sharif University of Technology Session # 7.  Contents  Systems Analysis and Design  Planning the approach  Asking questions and collecting data 
Domain Modeling (with Objects). Motivation Programming classes teach – What an object is – How to create objects What is missing – Finding/determining.
The chapter will address the following questions:
Chapter 3 Object-Oriented Analysis of Library Management System(LMS)
UML Sequence Diagrams Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
CPT 140 Programming Constructs1 OBJECT ORIENTED TECHNOLOGY Terminology and Basic Concepts.
Introduction To System Analysis and design
Use Cases Why use ‘em? How do they work? UC diagrams Using them later in the software development cycle.
1 CSc 131 Computer Software Engineering Fall 2012 Lecture # 7 Object-Oriented Design & UML Class Models.
What is a domain model? “A domain model captures the most important types of objects in the context of the business. The domain model represents the ‘things’
Design & Evaluation OO Software Design and Construction Computer Science Dept Va Tech February 2000 ©2000 McQuain WD 1 Class Design and Evaluation Class.
From Use Cases to Test Cases 1. A Tester’s Perspective  Without use cases testers will approach the system to be tested as a “black box”. “What, exactly,
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Introduction To System Analysis and Design
Sept Ron McFadyen1 Section 10.1 Domain Models Domain Model: a visual representation of conceptual classes or real-world objects in a domain.
Approaching a Problem Where do we start? How do we proceed?
CS3773 Software Engineering Lecture 04 UML Class Diagram.
Sommerville 2004,Mejia-Alvarez 2009Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Requirements as Usecases Capturing the REQUIREMENT ANALYSIS DESIGN IMPLEMENTATION TEST.
Lecture 13-17, chitkara university.  Gives a conceptual framework of the things in the problem space  Helps you think – focus on semantics  Provides.
A Use Case Primer 1. The Benefits of Use Cases  Compared to traditional methods, use cases are easy to write and to read.  Use cases force the developers.
Faculty of Applied Engineering and Urban Planning Software Engineering Department Software Engineering Lab Use Cases Faculty of Information system Technology.
1 Structuring Systems Requirements Use Case Description and Diagrams.
Lecture 6: Structural Modeling
Conceptual Model or Domain Models Chapter10 Applying UML and pattern.
1 What is OO Design? OO Design is a process of invention, where developers create the abstractions necessary to meet the system’s requirements OO Design.
Chapter 1 Applying UML and Patterns. The Need for Software Blueprints Knowing an object-oriented language and having access to a library is necessary.
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.
Design Model Lecture p6 T120B pavasario sem.
DATABASE MANAGEMENT SYSTEM ARCHITECTURE
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
CSC 131 Fall 2006 Lecture # 6 Object-Oriented Concepts.
Identifying Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 1 Getting Started In the.
Requirements specification Why is this the first major stage of software development? –Need to understand what customer wants first Goal of requirements.
Phase 6 Start: Saturday14 April End: Saturday 21 April
CMSC 202 A Design Exercise. 2 OO design activities Finding the Objects Defining the responsibilities –Services –Attributes Discovering relationships.
C++ Inheritance Data Structures & OO Development I 1 Computer Science Dept Va Tech June 2007 © McQuain Generalization versus Abstraction Abstraction:simplify.
Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects.
CMSC 345 Fall 2000 OO Design. Characteristics of OOD Objects are abstractions of real-world or system entities and manage themselves Objects are independent.
UML - Development Process 1 Software Development Process Using UML.
McGraw-Hill/Irwin© 2008 The McGraw-Hill Companies, All Rights Reserved Chapter 17 Object-Oriented Design and Modeling Using the UML.
Fusion Design Overview Object Interaction Graph Visibility Graph Class Descriptions Inheritance Graphs Fusion: Design The overall goal of Design is to.
OO DomainModeling With UML Class Diagrams and CRC Cards Chapter 6 Princess Nourah bint Abdulrahman University College of Computer and Information Sciences.
Kyung Hee University Class Diagramming Notation OOSD 담당조교 석사과정 이정환.
High Level Design Use Case Textual Analysis SE-2030 Dr. Mark L. Hornick 1.
OBJECT-ORIENTED TESTING. TESTING OOA AND OOD MODELS Analysis and design models cannot be tested in the conventional sense. However, formal technical reviews.
1 7 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 7 The Object-Oriented Approach to Requirements.
Introduction: Databases and Database Systems Lecture # 1 June 19,2012 National University of Computer and Emerging Sciences.
Databases and Database User ch1 Define Database? A database is a collection of related data.1 By data, we mean known facts that can be recorded and that.
Recall The Team Skills Analyzing the Problem
Object Oriented Concepts -I
OO Domain Modeling With UML Class Diagrams and CRC Cards
Start at 17th March 2012 end at 31th March 2012
OO Domain Modeling With UML Class Diagrams and CRC Cards
Unified Modeling Language
Data Model.
Copyright 2007 Oxford Consulting, Ltd
CS 2704 Object Oriented Software Design and Construction
Use Case Analysis – continued
Presentation transcript:

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 1 Designing the Classes Once a set of candidate objects is determined… we must: Determine which are "real" objects in the system. Identify their attributes. -attributes are data -define what the data is, not how it is to be represented (that comes later) Identify their responsibilities. -public services (behaviors) the object must provide -may imply certain attributes necessary to provide those services -define what the service is, not how it to be accomplished -some services may be private, but those are usually identified later -services are invoked though message passing

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 2 Identifying Attributes An attribute is a single characteristic which is common to all instances of a class. Look for adjectives and possessive phrases in the requirements document. Find a general description of the object. Determine what parts of the description are applicable to the problem domain. Four categories of attributes: descriptive naming state information referential (relationship links)

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 3 Eliminating Attributes Some apparent attributes may be considered independently of the objects — make those objects in their own right. Rumbaugh: if an attribute is changed in the system w/o being part of any entity, then it should be an object. Relationships among objects may also have attributes. Do not confuse those with attributes of the involved objects. Eliminate minor details that do not affect methods.

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 4 Specifying Attributes An attribute should be atomic (simple). Eliminate attributes that can be calculated from others. Eliminate attributes that address normalization, performance, or other implementation issues. Verify that the attributes make semantic sense together.

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 5 Data Versus State Definition: Information processed by the system Example: The identity of the patron and the book when a book is checked out to the patron. Data State Definition: Information used by system to control processing Example: Whether a book is already checked out, available, or unknown when a request is made for it. Perhaps the number of books checked out to a patron.

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 6 Identifying Responsibilities Look for verb in the requirements document — usually this will define services of the object of the sentence E.g.Quarterback throws the ball. This defines a service for the ball, provided by the quarterback. Look at user scenarios — different ways the system can be used. Look at each feature — require services of many objects.

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 7 Specifying Responsibilities Name the service to match the external request for the service. RegisterPatron CheckInBook Identify the information and/or entities necessary to provide the service. patron name, address, patron list book ISBN or call number, patron id, catalog, patron list, ?? Identify the responses, if any, that the service will generate. success, failure, patron id success, invalid call number, invalid patron

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 8 Example: Library System Consider the Patron class for the Library System: Name:Patron Attributes: Name, Address, Membership Number Fees due?? List of checked out items?? Responsibilities: Report Name, Address, Membership Number Update fees due?? Record books this patron has checked out?? When are the attributes set? Which of the attributes are mutable?

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 9 Guidelines for Designing the Classes We need a systematic way of determining the attributes and responsibilities of a class. Otherwise, we run a large risk of missing essential features. To identify attributes and responsibilities the designer must ask the right questions regarding the system being designed. We can provide some guidance in choosing what questions to ask…

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 10 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 Kafura

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 11 Example: Library System Behavioral (actions): – patrons are registered (who does this??) – books are checked in/out (who does this??) Structural (relationships): – catalog contains a list of books – patron may have one or more books – someone has a list of patrons Informational (state): – a book may be available/checked out/?? – a book may be checked out to a specific patron (state or relationship??) Specification: Design a library catalog system. The system must support the registration of patrons, adding and removing books, checking books in and out, satisfying queries regarding the availability of books, and determining which patron has a book.

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 12 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

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 13 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

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 14 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 establishing the relationship Catalog and PatronList… – are necessary to sustain the relationship ???... – is aware of and exploits the relationship

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 15 Structural Categories Acquaintance(symmetric, asymmetric) – CirculationDesk knows about Catalog, asymmetric relationship Containment(collaborator, controller) – CirculationDesk controls/uses CheckedOut Collection(peer, iterator, coordinator) – PatronList contains and manages Patrons – Catalog contains and manages Books – CheckedOut contains and manages ??

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 16 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, PatronList and Catalog implicitly… – represent (stores) the state information CirculationDesk… – interrogates the state of a book (via …) CirculationDesk… – updates the state of a book

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 17 Example: Preliminary Overall Design Here's a partial, preliminary design, based on the preceding discussions: Book string Author; string Title; string Call; Catalog * Patron List Patron * Circulation CheckedOut string Call string PatronID * means "contains a collection of". means "knows about". For simplicity, this omits the procedural controller and the parser.

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 18 Example: Library System Consider the Patron class for the Library System: Name:Book Attributes: Title Author Call Number … Responsibilities: Report Title Report Author Report Call Number All of these attributes are immutable. Provide access, but not modification.

Designing Classes OO Software Design and Construction Computer Science Dept Va Tech January 2002 ©2002 McQuain WD & Keller BJ 19 Example: Library System Consider the Patron class for the Library System: Name:CirculationDesk Attributes: Catalog PatronList CheckedOutList … Responsibilities: RegisterPatron CheckBookIn CheckBookOut SearchByCallNumber … Each of these attributes is another object… …but these may be links (pointers or references). Provide support for the basic operations from the spec through the CirculationDesk interface.