Download presentation
Presentation is loading. Please wait.
1
Advanced Java Programming
Session #, Speaker Name Advanced Java Programming CSS446 Spring 2014 Nan Wang 08/24/11
2
Chapter Goals To learn how to discover new classes and methods
To use CRC cards for class discovery To identify inheritance, aggregation, and dependency relationships between classes To describe class relationships using UML class diagrams To apply object-oriented design techniques to building complex programs
3
Discovering Classes Requirements specification: a description of what your program should do. To discover classes, look for nouns in the problem description. Concepts from the problem domain are good candidates for classes.
4
Print an invoice Invoice Customer LineItem
5
CRC Card Method A simple rule for finding these methods is to look for verbs in the task description. CRC card describes a class, its responsibilities, and its collaborating classes. C: Classes;R: Responsibilites;C: Collaborators
6
Relationships Between Classes
Dependency Aggregation Inheritance
7
Dependency A class depends on another class if it uses objects of that class. It is a good practice to minimize the coupling (i.e., dependency) between classes.
8
Aggregation Aggregation relationship is informally known as the “has-a” relationship. The aggregation relationship states that objects of one class contain objects of another class. Aggregation is a stronger form of dependency
9
Aggregation A car has a motor and tires. In object- oriented design, this “has-a” relationship is called aggregation.
10
Inheritance Inheritance is a relationship between a more general class (the superclass) and a more specialized class (the subclass). This relationship is often described as the “is-a” relationship.
11
Attributes and Methods in UML
12
Multiplicities • any number (zero or more):* • one or more:1..*
• zero or one:0..1 • exactly one:1
13
Five-part program development process
1. Gather requirements. 2. Use CRC cards to find classes, responsibilities, and collaborators. 3. Use UML diagrams to record class relationships. 4. Use javadoc to document method behavior. 5. Implement your program.
20
Challenging Project – 150 points
21
Benchmark Project – 100 points
22
Programming Assignment
Due date: Feb 27 Midterm March 3: No Class on March 6 (Conference)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.