1 Object Oriented Design and UML Software Development Activities Object Oriented Design Unified Modeling Language (UML) Reading for this Lecture: L&L 6.1.

Slides:



Advertisements
Similar presentations
COMP 121 Week 7: Object-Oriented Design and Efficiency of Algorithms.
Advertisements

CS210 Intermediate Computing with Data Structures (Java)
Systems Analysis and Design 8th Edition
Sequence Diagrams. Introduction A Sequence diagram depicts the sequence of actions that occur in a system. The invocation of methods in each object, and.
CS3773 Software Engineering Lecture 03 UML Use Cases.
Interaction Diagrams Activity Diagram State Machine Diagram
Problem Solving #1 ICS Outline Review of Key Topics Review of Key Topics Example Program Example Program –Problem 7.1 Problem Solving Tips Problem.
Object-Oriented Analysis and Design
Department of Computing
Object Oriented Design and UML
Chapter 1 Software Development. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 1-2 Chapter Objectives Discuss the goals of software development.
Systems Analysis & Design Sixth Edition Systems Analysis & Design Sixth Edition Toolkit Part 5.
1 Lecture 5 Introduction to Software Engineering Overview  What is Software Engineering  Software Engineering Issues  Waterfall Model  Waterfall Model.
© Copyright Eliyahu Brutman Programming Techniques Course.
Chapter 1 Program Design
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
The chapter will address the following questions:
Object-Oriented Design. From Analysis to Design Analysis Artifacts –Essential use cases What are the problem domain processes? –Conceptual Model What.
Prepared by Afra`a Sayah. Introduction. Weekly Tasks. Plane Phase. Analysis Phase. Design Phase. Report Rules. Conclusion. 2.
1 Mass IT Course Fall 2008 Bob Wilson S
Object-Oriented Analysis and Design An Introduction.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Copyright 2002 Prentice-Hall, Inc. Chapter 2 Object-Oriented Analysis and Design Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey.
Systems Analysis and Design in a Changing World, 6th Edition 1 Chapter 4 Domain Classes.
Systems Analysis & Design 7 th Edition Chapter 5.
To navigate the slide presentation, use the navigation bar on the left OR use your right and left arrow keys. Move your mouse over the key terms throughout.
Systems Analysis and Design 8 th Edition Chapter 6 Object Modeling.
Chapter 1 Program design Objectives To describe the steps in the program development process To introduce the current program design methodology To introduce.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
240 3/30/98 CSE 143 Object-Oriented Design [Chapter 10]
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.
1 CS210 Intermediate Computing with Data Structures (Java) Saaid Baraty S-3-90.
2131 Structured System Analysis and Design By Germaine Cheung Hong Kong Computer Institute Lecture 8 (Chapter 7) MODELING SYSTEM REQUIREMENTS WITH USE.
BCS 2143 Object Oriented Design Using UML. Objectives Objects Interactions Finding Classes Relationship Between Classes Attribute and Operation Class.
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
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.
Information Systems Analysis and Management Modeling Sys. Requirements with Use Cases Arnie Lund, Jeffrey Kim May 5, 2009 INFO380.
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
CSCI 1100/1202 April 1-3, Program Development The creation of software involves four basic activities: –establishing the requirements –creating.
Domain Classes – Part 1.  Analyze Requirements as per Use Case Model  Domain Model (Conceptual Class Diagram)  Interaction (Sequence) Diagrams  System.
Data Structures Using C++ 2E
Designing Classes CS239 – Jan 26, Key points from yesterday’s lab  Enumerated types are abstract data types that define a set of values.  They.
Scenario A scenario is a sequence of steps describing an interaction between a user and a system. Use case is a set of scenarios tied together by a common.
Software Engineering and Object-Oriented Design Topics: Solutions Modules Key Programming Issues Development Methods Object-Oriented Principles.
1 Object-Oriented Design Now we can extend our discussion of the design of classes and objects Chapter 6 focuses on: software development activities determining.
Object-Oriented Analysis and Design Use cases Finding classes Collaboration and Sequence diagrams Associations between classes.
UML Course Instructor: Rizwana Noor. Overview  Modeling  What is UML?  Why UML?  UML Diagrams  Use Case  Components  Relationships  Notations.
© 2004 Pearson Addison-Wesley. All rights reserved October 31, 2007 Static Class Members ComS 207: Programming I (in Java) Iowa State University, FALL.
McGraw-Hill/Irwin© 2008 The McGraw-Hill Companies, All Rights Reserved Chapter 17 Object-Oriented Design and Modeling Using the UML.
Use Case Diagrams. Introduction In the previous Lecture, you saw a brief review of the nine UML diagrams. Now that you have the clear, you'll start to.
Chapter 7 Part II Structuring System Process Requirements MIS 215 System Analysis and Design.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
Distributed Java Programming Distributed Java Programming Class #1 August 20, 2002.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
CHAPTER 6 OBJECT ANALYSIS.
CSE 501N Fall ‘09 06: Data Abstraction & Design
Introduction to OOP and UML
Roberta Roth, Alan Dennis, and Barbara Haley Wixom
The Movement To Objects
The Object-Oriented Thought Process Chapter 1
Unified Modeling Language
Introduction to Unified Modeling Language (UML)
About the Presentations
OO Domain Modeling With UML Class Diagrams and CRC Cards
Chapter 5 – Writing Classes
Static Class Members March 29, 2006 ComS 207: Programming I (in Java)
Software Engineering System Modeling Chapter 5 (Part 1) Dr.Doaa Sami
Outline Anatomy of a Class Encapsulation Anatomy of a Method
Chapter 5.
Outline Software Development Activities
Presentation transcript:

1 Object Oriented Design and UML Software Development Activities Object Oriented Design Unified Modeling Language (UML) Reading for this Lecture: L&L 6.1 – 6.3

2 Software Development Software involves four basic activities: 1. Establishing the requirements 2. Creating a design 3. Implementing the code 4. Testing the implementation These activities are not strictly linear – they overlap and interact We’ve already done a lot with #3 and #4 Now, we’ll concentrate on #1 and #2

3 Requirements Software requirements specify the tasks that a program must accomplish –what to do, not how to do it Often an initial set of requirements is provided, but they should be critiqued and expanded It is difficult to establish and document detailed, unambiguous, and complete requirements Careful attention to the requirements can save significant time and expense in the overall project

4 Design A software design specifies how a program will accomplish its requirements That is, a software design determines: –how the solution can be broken down into manageable pieces –what each piece will do An object-oriented design determines which classes and objects are needed and specifies how they will interact Low level design details include how individual methods will accomplish their tasks

5 Object-Oriented Design Design Methodology / Process –Analyze / decompose the requirements –Determine the classes required for a program –Define the relationships among classes Tool: Unified Modeling Language (UML) –Use Case Diagram –Class Diagram –Interaction Diagram

6 Identifying Classes and Objects The core activity of object-oriented design is determining the actors, classes, and objects that represent the problem and its solution The classes may be part of a class library, reused from a previous project, or newly written One way to identify potential classes is to identify the objects discussed in the requirements Objects are generally nouns, and the services that an object provides are generally verbs

7 Identifying Classes and Objects A partial requirements document: The user must be allowed to specify each product by its primary characteristics, including its name and product number. If the bar code does not match the product, then an error should be generated to the message window and entered into the error log. The summary report of all transactions must be structured as specified in section 7.A. Of course, not all nouns will correspond to an actor, class or object in the final solution

8 Identifying Classes and Objects A class represents a group (a “classification”) of objects with the same attributes and behaviors Generally, classes that represent objects should be given names that are singular nouns Examples: Coin, Student, Message A class represents the concept of one such object We are free to instantiate as many “instances” of each object as needed Good selection of object names for the instances can be helpful to understanding

9 Identifying Classes and Objects Sometimes it is challenging to decide whether something should be represented as a class For example, should an employee's address be represented as a set of instance variables or as an Address object The more you examine the problem and its details the more clear these issues become When a class becomes too complex, it often should be decomposed into multiple smaller classes to distribute the responsibilities

10 Identifying Classes and Objects We want to define classes with the proper amount of detail For example, it may be unnecessary to create separate classes for each type of appliance in a house It may be sufficient to define a more general Appliance class with appropriate instance data It all depends on the details of the problem being solved

11 Identifying Classes and Objects Part of identifying the classes we need is the process of assigning responsibilities to each class Every activity that a program must accomplish must be represented by one or more methods in one or more classes We generally use verbs for the names of methods In early stages it is not necessary to determine every method of every class – begin with primary responsibilities and evolve the design

12 Unified Modeling Language (UML) UML is a graphical tool to visualize and analyze the requirements and do design of an object-oriented solution to a problem Three basic types of diagrams: –Use Case Diagram –Class Diagram –Interaction Diagram A good reference is UML Distilled, 3 rd Ed., Martin Fowler, Addison-Wesley/Pearson

13 Unified Modeling Language (UML) Advantage of UML – It is graphical –Allows you to visualize the problem / solution –Organizes your detailed information Disadvantage of UML – It is graphical –Can be done with pencil and paper - tedious –We have UMLPAD which is a simple design tool to aid in drawing the diagrams –Commercial UML S/W tools may be expensive! Example: Rational ROSE (IBM acquired Rational)

14 Use Case Diagrams Typically the first diagram(s) drawn Helpful for visualizing the requirements Icons on the Use Case Diagram –Actors: Users or other external systems –Objects: Potential classes in the solution –Scenarios: Sequences of interactions between Actors and Objects that are typical for the solution to the problem (Both success cases and error cases should be included)

15 Example: Use Case Diagram Actors: Sales person, Customer, Bartender Objects: Products, Cash, Cash Register, Credit Card, Card Swipe Machine, Bank Scenarios involving Actors and Objects: –Customer listens to sales pitch but doesn’t buy –Customer buys product with cash –Customer buys product with credit card Success scenario: Bank accepts the card Error scenario: Bank says card is “maxed out”

16 Example: Use Case Diagram “No Sale” Buy with Cash Buy On Credit Customer Sales Person Cry over lost commission Bartender Process Cash Sale Cash Register Credit Card Bank Process Credit Sale Cash Card Swipe Machine Stiff Drink Product >

17 Example: Scenario Process Credit Sale –Swipe Card –Enter Amount of Sale –Wait for Bank Response –Success Variation (Bank accepts charge) Record authorization number Get customer signature Give customer product(s) and receipt –Error Variation (Card maxed out) Inform Customer that card was rejected > Cry over Lost Commission

18 Class Diagrams Classify the Objects in the Use Cases Define name of each class Define each class’s attributes –Constants –Variables Define each class’s behaviors –Methods Show relationships between classes –Depends on, Inherits, etc.

19 Example: Class Diagram Credit Card - myCardData : CardData + read( ) : CardData Bank - name : String - address : String - accounts [ ] : AcctData + processCharge ( thisCardData : CardData amt : double, storeName : String, storeBank : Bank, storeAcctNumber : int ) : boolean CardData - cardType : enum {Visa, …} - myBank : Bank - myAcctNumber : int + getCardType( ) : enum + getBank( ) : Bank + getAcctNumber( ) : int AcctData -acctLimit : double -acctBalance: double …

20 Interaction Diagrams Shows the time relationship of the events in a scenario between actors and objects –UML Sequence Diagram –Sometimes called a “ladder diagram” A vertical line represents an actor or object A horizontal line represents an interaction –E.G. a call to a method of another object Progress of time is shown down the page

21 Example: Interaction Diagram Process Credit Sale Sales Person Credit Card Card Swipe Machine Bank read( ) processCharge( … ) enterAmt(…) swipeCard( ) return boolean return CardData Time readResponse( ) return “OK”

22 Introduction to Project 3 In Project 3, you will write a class that encapsulates the three integer coefficients of a linear equation: ax + by = c The methods are defined in the assignment The class implements the interface Comparable (we’ll cover implementing interfaces shortly)

23 > java.lang.Comparable Equation java.util.Arrays + sort (array : Object [ ]) : void EquationTest Your ApplicationClass Provided You write Class Library + main (args : String [ ]) : void + compareTo (that : T) : int

Equation Class UML Diagram Equation implements Comparable + THRESHHOLD : double // threshold for comparisons of double values - a : int // coefficient of the variable x - b : int // coefficient of the variable y - c : int // constant + Equation(a : int, b : int, c : int) // constructor + toString( ) : String // return a String representing the equation + slope( ) : double // return the slope of the line + intercept( ) : double // return the y-axis intercept of the line + compareTo(that : Equation) : int // compare values of equations // solving methods for pairs of equations: + solveForXWith(that : Equation) : double // solve for X + solveForYWith(that : Equation) : double // solve for Y + verifySolution(x : double, y : double) : boolean // verify correct