
Object-Oriented analysis and design • Special nature of OO development • Use cases • Design with UML • OO system design • OO program design • OO measurements Chapter 6
Object orientation • identity • abstraction • classification • encapsulation • inheritance • polymorphism • persistence Chapter 6
Objects and classes • Every object has a name (also called a reference or handle). • Objects can have attributes (such as color, size, location). • Objects can have operations or behaviors (such as takeoff, land, repair). • Each object is an instance of a class. • A specific implementation of an operation for a certain class is called a method. Chapter 6
Classification Chapter 6
Forming a hierarchy Chapter 6
OO design • Usually uses an OO requirements representation • System design identifies and represents objects and classes, plus details of each objects attributes and behaviors. • System design also identifies interactions and relationships. • Program design inserts computational features in the models. • Program design inserts class library details. • Program design considers nonfunctional requirements to enhance design. Chapter 6
OO and testing Chapter 6
Use cases • Diagrams have four elements: • actors • cases • extensions • uses Chapter 6
Identifying participants • What users or groups use the system to perform a task? • What users or groups are needed so that the system can perform its functions? • What external systems use the system to perform a task? • What external systems, users or groups send information to the system? • What external systems, users or groups receive information from the system? Chapter 6
Example: Service station Chapter 6
Service station use case diagram 1 Chapter 6
Service station use case diagram 2 Chapter 6
Service station use case diagram 3 Chapter 6
UML and the OO process • Workflow diagrams • Object model • Sequence diagrams • Collaboration diagrams • Package diagrams • Component diagrams • Deployment diagrams Chapter 6
UML support for development process Chapter 6
First cut at object classes • Structures • External systems • Devices • Roles • Operating procedures • Places • Organizations • Things that are manipulated by the system to be built Chapter 6
Class box example Chapter 6
Inheritance relationship Chapter 6
Association relationship Chapter 6
Types of class relationships Chapter 6
UML notes and qualifies Chapter 6
Service Station – first take Chapter 6
Service Station – second take Chapter 6
Service Station – final cut Chapter 6
Class name: refuel Category: service External documents: Export control: Public Cardinality: n Hierarchy: Superclasses: services Associations: fuel in association <name> Operation name: price Public member of: refuel Documentation: // Calculates fuel final price Preconditions: gallons > 0 Object diagram: (unspecified) Semantics: final_price = gallons * price Object diagram: (unspecified) Concurrency: sequential Public interface: Operations: price Private interface: Attributes: gallons price Implementation: Attributes: gallons price State machine: no Concurrency: sequential Persistence: transient Chapter 6
Service Station – package diagram Chapter 6
Sequence Station – sequence diagram for the refuel use case Chapter 6
Service Station – collaboration diagram for the perking use case Chapter 6
State diagram example Chapter 6
State diagram for Fuel class Chapter 6
State diagram for Part class Chapter 6
State diagram for Inventory class Chapter 6
Activity diagram Chapter 6
Activity diagram for Inventory class Chapter 6
Guidelines for building classes • What needs to be “processed” in some way? • What items have multiple attributes? • When do you have more than one object in a class? • What is based on the requirements themselves, not derived from your understanding of the requirements? • What attributes and operations are always applicable to a class or object? Chapter 6
Guidelines for identifying behaviors • Imperative verbs • Passive verbs • Actions • Things or reminded events • Roles • Operating procedures • Services provided by an organization Chapter 6
Program design considerations • Nonfunctional requirements • Reused components • Reusable components • User interface requirements • Data structure and management details Chapter 6
Transition from paper to screen Chapter 6
Possible design for new billing screen Chapter 6
Observer pattern - relationships Chapter 6
Observer pattern – sequence diagram Chapter 6
Class hierarchy for the Service Station Chapter 6
Measuring Service Station system design Chapter 6
Measuring Service Station program design Chapter 6