Presentation is loading. Please wait.

Presentation is loading. Please wait.

Big Java Chapter 12. Software Process - Waterfall Analysis Design Implementation Testing Deployment Does not work well when rigidly applied! established.

Similar presentations


Presentation on theme: "Big Java Chapter 12. Software Process - Waterfall Analysis Design Implementation Testing Deployment Does not work well when rigidly applied! established."— Presentation transcript:

1 Big Java Chapter 12

2 Software Process - Waterfall Analysis Design Implementation Testing Deployment Does not work well when rigidly applied! established early 1970s What do customers really want? Design not very efficient, but oh well Inconsistent requirements? Customers not happy 

3 Software Process – Spiral* Implementation Testing Deployment prototype #1 prototype #2 final product Analysis Design *should be spirals, not circles, but no arcs in PP implement prototypes quickly Issue: s/w engineers may think there will always be another iteration, don’t deliver quality

4 Reading Assignment Random Fact 12.1, Programmer Productivity, page 535

5 Discovering Classes Required tasks: 1.Discover classes 2.Determine responsibilities of each class 3.Describe relationships between classes We’ve already talked about using nouns as possible classes/objects and verbs as the possible methods.

6 Points to Consider A class represents a set of objects with the same behavior. The design should capture the commonalities. Some entities will be objects, others will be primitive types. How to decide? Example: an address could either be a simple string or a class. If your system needs to do special processing on the address, a class may be called for. Otherwise, keep it simple. Not all classes will be discovered in analysis phase. Most systems have extra classes for tactical purposes, such as database access, GUI, etc. Use existing classes, extended as needed, where you can.

7 Assigning methods - CRC Sometimes it is difficult to determine which class should implement a particular method. CRC card method – Classes, Responsibilities, Collaborators –Use index card for each class –Write responsibilities on the class card –Also record which other classes are needed to fulfill that task (collaborators)

8 CRC Example Invoice compute amount dueLineItem Responsibilities Collaborators Does this class have needed methods? such as getTotalPrice? Tasks can be simulated by moving tokens from one card to the next as objects are called on to do their methods These should be high level

9 Class Relationships Be sure inheritance really represents is-a relationships. Is a tire a circle? No, tire is a car part; circle is a geometric object. A tire has a circle as its boundary. public class Tire { … private Circle boundary; } This type of relationship is called aggregation.

10 Another example public class Car extends Vehicle { … private Tire[] tires; } is-a (inheritance) has-a (aggregation) Vehicle Car Tire UML Symbols Inheritance Interface Implementation Aggregation Dependency

11 More UML UML class diagrams may list attributes (often instance variables) and methods. Actual class may not store data that way (e.g., Date class stores as # milliseconds, but has day, month and year attributes) May not list all attributes and methods, depends on purpose of diagram Don’t list as attribute if also an aggregation May show multiplicities for aggregates –any number : * –one or more: 1..* –zero or one: 0..1 –exactly one: 1 Cluttered picture not very valuable!

12 Association Sometimes “has” doesn’t really represent relationship Does bank “have” customers, do customers “have” bank? More general relationship is association Use solid line with arrows to show that it’s possible to navigate from objects of one class to objects of another May add text to explain relationship (e.g., serves on line from Bank to Customer) Association vs Aggregation not an important distinction – use it if it helps make design clearer!

13 More UML Examples Customer BankAccount 1..* Customer Bank serves Bank Account balance deposit() withdraw()

14 CRC Exercise Preparation Reading Assignment: Case Study pages 544-556, Printing an Invoice Reading Assignment: Case Study pages 556-577, ATM ATM case study shows UML and also state diagrams (next two slides) Exercise on Thursday IMPORTANT! Allocate 10 minutes to read the case studies before the exercise on Thursday. Bring your stories!!!

15 ATM State Diagram Start PIN Account Transact Customer number entered Customer found Customer not found Exit selected Account selected Transaction completed or canceled

16 ATM UML ATMFrame Keypad ATM Bank Customer BankAccount 1 1 1 2 * Does the ATM aggregate customers? – design decision GUI classes

17 ATM Case Study ATM manage stateCustomer select customer select account execute transaction Bank BankAccount

18 CRC Exercise Apply the CRC method to develop classes for the stories you wrote in the previous exercise Create UML diagrams for those classes


Download ppt "Big Java Chapter 12. Software Process - Waterfall Analysis Design Implementation Testing Deployment Does not work well when rigidly applied! established."

Similar presentations


Ads by Google