CSC 480 Software Engineering PSP Project 2 August 27, 2004

Embed Size (px)

DESCRIPTION

CSC Software Engineering3 8/27/2004 Project 1 Postmortem Sample data  Planned and actual times  Planned and actual LOC  Defects (actual and planned, optional)  LOC/minutes  Time in phases (percent) Comments

Citation preview

CSC 480 Software Engineering PSP Project 2 August 27, 2004 CSC Software Engineering2 8/27/2004 Topics PSP Project 1 postmortem Estimating program size OOAD essentials PSP Project 2 the problem CSC Software Engineering3 8/27/2004 Project 1 Postmortem Sample data Planned and actual times Planned and actual LOC Defects (actual and planned, optional) LOC/minutes Time in phases (percent) Comments CSC Software Engineering4 8/27/2004 Size Estimation Need historical data Good correlation between Estimated and actual times Actual LOC and actual time spent Function point method CSC Software Engineering5 8/27/2004 Estimated v.s. Actual LOC 25 C++ programs CSC Software Engineering6 8/27/2004 Estimated LOC v.s. Actual Hours 25 C++ programs CSC Software Engineering7 8/27/2004 Sizes In LOC Per Method CSC Software Engineering8 8/27/2004 Analysis & Design Roadmap Find the objects (classes of objects) Determine their responsibilities Determine collaborations Use UML diagrams and other diagrams to present your design CSC Software Engineering9 8/27/2004 Printing Invoices a sample application An invoice describes the charges for a set of products in certain quantities. (We omit complexities such as dates, taxes, and invoice and customer numbers.) The program simply prints the billing address, all line items, and the amount due. Each line item contains the description and unit price of a product, the quantity ordered, and the total price. CSC Software Engineering10 8/27/2004 A Sample Invoice INVOICE Sams Small Appliances 100 Main Street Anytown, CA DescriptionPrice Qty Total Toaster Hair dryer Car vacuum AMOUNT DUE: $154.78 CSC Software Engineering11 8/27/2004 Identify Objects Classes correspond to nouns in the problem description Invoice Address Item Product Description Price Quantity Total Amount Due Invoice Address Item Product Class candidates Classes elimination CSC Software Engineering12 8/27/2004 Determine Responsibilities Responsibilities include two key items The knowledge an object maintains, and The actions an object can perform Assigning responsibilities to classes Evenly distribute system intelligence Keep behavior with related information Keep info about one thing in one place CSC Software Engineering13 8/27/2004 Class Or Attribute A class has the potential to be used in multiple places in an application usually has multiple attributes Example A Product object has two attributes Description Price CSC Software Engineering14 8/27/2004 Class Diagram Invoice -billingAddress:Address -items:ArrayList +add(aProd:Product, qtty:int) +format():String +getAmountDue():double Class name Attributes Operations var:type -private +public ~package #protected CSC Software Engineering15 8/27/2004 Class Stub Code public class Invoice { /** Adds a charge for a product to this aProd the product that the user quantity the quantity of the product */ public void add(Product aProd, int quantity) { } /** Formats the the formatted invoice */ public String format() { } } CSC Software Engineering16 8/27/2004 Examine Relationships Important relationships Inheritance aka the is-a relationship Congregation aka the has-a relationship Dependency similar to uses Visibility Cardinality CSC Software Engineering17 8/27/2004 The Invoice Classes Invoice Item Address Product CSC Software Engineering18 8/27/2004 Collaborations Ways for an object to fulfill its responsibilities Performing computation by itself Collaborating with other objects A collaboration is the embodiment of the contract between a client and a server client contract server request CSC Software Engineering19 8/27/2004 CRC Card Class-Responsibility-Collaboration Cards Used to record collaborations Collaborations are associated with responsibilities Class: Item Format item Product Get total price Class: Product Get description Get price responsibilities collaborations CSC Software Engineering20 8/27/2004 Unit Test Cases Its critical to ensure an object can fulfill its responsibilities correctly before integration OOP requires frequent integration due to collaborations among objects Write a test case for each non-trivial public method with know input and expected output CSC Software Engineering21 8/27/2004 Acceptance Test Functional walk-through Plan testing based on use cases Print invoice system CSC Software Engineering22 8/27/2004 Project 2 The Problem Two options to choose from: A simplemessaging system A personal appointment book See the assignment doc file under course folder Due by next Friday, September 3