Teaching the Complete Objectoriented Development Cycle Including OOA
Teaching the Complete Objectoriented Development Cycle, Including OOA and OOD, with UML and the UP Robert B. Jackson Brigham Young University John W. Satzinger Southwest Missouri State University
We are teaching some OO Use case concepts n UML class diagrams n OO concepts n OO programming languages n ¨ Java ¨ VB ISECON 2003 San Diego . NET Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 2
But are we teaching OOA and OOD? Highly iterative development process? n Emphasis on interacting objects? n Three-layer architectures? n Use case realization through design? n Design principles and quality design? n Design patterns? n Models that directly support OOP? n ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 3
OO Development using UML and the UP n Model Driven Development ¨ Analysis Models drive discovery and understanding ¨ Design Models drive architecture and solution n Use Case Driven Development ¨ Both Analysis and Design based on use cases ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 4
UP phases and iterations ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 5
UP disciplines and iterations ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 6
Object-oriented approach to Requirements OOA using UML Requirements Models
What is OO Analysis? OOA is not a phase of an SDLC in the UP n OOA per se is not used in the UP n OOA is really business disciplines of n ¨ Business Modeling ¨ Requirements ¨ Analysis n OOA still implies “discovery” and “understanding” ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 8
UML Models for Business Modeling and Requirements 1. Use Case Models Use Case Diagram ¨ Use Case Descriptions ¨ 2. 3. 4. 5. Activity Diagrams for Workflow System Sequence Diagrams for Inputs/Outputs Domain Model Class Diagrams Statecharts for Status Information ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 9
Use Cases and Use Case Diagram Although not “Object-oriented” it forms the basis for all other analysis and design activities – i. e. building a system is “Use Case Driven. ” n Use Case Diagram contains “Actors” and “Use Cases” n ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 10
A Partial Use Case Diagram ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 11
Detail Descriptions of Use Cases Fully developed description (textual) n Activity Diagram (graphical) n ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 12
Fully Developed Use Case Description Use Case Name: Checkout Movies Scenario: Checkout movies at counter Triggering Event: Customer brings movies to checkout counter Brief Description: When customer brings movies to counter, clerk checks membership ID, clerk scans in each movie identifier, takes payment, and notifies customer of return due date and time. Actors: Video clerk Related Use Cases: Add new member Stakeholders: Clerk, Store manager Preconditions: Movie titles must exist Movie copy must exist Customer must exist (or Add new member must be invoked) Postconditions: Video Rental and rental line items must be created Payment transaction must be created Status of movie copy must be updated Copyright © must 2003 bybe R. connected B. Jackson and J. W. Satzinger Video Rental to customer family member ISECON 2003 San Diego All Rights Reserved 13
Fully Developed Use Case Description (cont) Flow of Events Exception Conditions: ISECON 2003 San Diego Actor System 1. Customer brings movies to checkout counter and presents membership card. 2. Video clerk scans card 3. Clerk scans each movie 4. Clerk indicates end of transaction 5. If coupon or special, clerk enters coupon information 6. Enter payment 7. Give movies, receipt, change to customer. 2. 1 Checks membership ID. 2. 2 Checks for any outstanding fines or late return fees. 2. 3 Displays appropriate information 2. 4 Creates new Video Rental 3. 1 Creates Rental line item 3. 2 Updates movie copy status 4. 1 Display Total amount due, including tax and late fees. 5. 1 Recalculate amount due 6. 1 Process payment 6. 2 Print receipt 1. 1 Customer is not a valid customer – invoke create new customer use case, or reject customer status. 6. 1 If payment is by credit card and credit card transaction is not authorized, (a) cancel transaction or (b) pay by Copyright © cash. 2003 by R. B. Jackson and J. W. Satzinger 14 All Rights Reserved
Activity Diagram showing workflows n Used to capture user procedures n Used to describe sequence of steps for Use Case description (similar to Fully Developed Description) n Easy for users to read and understand n ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 15
Activity Diagram for Add New Movie ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 16
System Sequence Diagram Use case driven (one SSD for each use case) n Identifies the inputs to and outputs from the system n Analysis oriented – focuses on the business processes not on the internal system interactions n An easy introduction to Interaction Diagrams n ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 17
System Sequence Diagram for Add New Movie ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 18
Problem Domain Class Diagram Coordinate with Database Course? n Identifies problem domain objects and relationships between those objects n Analysis focuses only on problem domain objects – discovery and understanding of business objects n ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 19
Problem Domain Class Diagram ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 20
Statechart Diagrams Optional diagram – many developers do not use n Can be complex, therefore initially only introduce simple cases n Use for discovery and understanding of the behavior of business objects n Use to document “Status” conditions that the system must track n ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 21
Statechart Diagram ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 22
Recap of OOA We have a complete set of models that describe many (all) aspects of the problem domain and business requirements n Problem oriented – discovery and understanding n Focuses on the business requirements and not on design issues of the system n ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 23
Object Oriented Approach to Design OOD with UML Design Models
What is OOD? OOD is not a phase in the UP SDLC n OOD is a business disciplines in the UP n OOD is the bridge between Requirements and Programming n OOD is a “developer” activity, not a user activity n Few programs teach OOD – mostly we teach analysis and programming n ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 25
UML Models for OOD n Design Class Diagrams ¨ Problem domain classes ¨ View layer classes ¨ Data Access layer classes n Detail Interaction Diagrams ¨ Sequence Diagrams ¨ Collaboration Diagrams n Advanced Statechart Diagrams (optional) ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 26
Making OOD an “Engineering Discipline” Engineering disciplines have principles, standards, techniques, practices, and body of knowledge n OOD is still developing, but we now are beginning to see design principles and practices n ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 27
Making OOD an “Engineering Discipline” n Principles of “good” design ¨ Cohesion ¨ Coupling ¨ Object Responsibility ¨ Protection from variations ¨ Object visibility n Design Patterns for standard solutions ¨ Gang of four (Go. F) design patterns ¨ Enterprise level design patterns (J 2 EE) ¨ Microsoft Application design patterns ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 28
ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 29
Multi-layer Design Class Diagrams n n n Includes problem domain classes Includes service and utility classes Includes view layer classes Includes data access layer classes Advanced concepts ¨ Advanced design can get complex for enterprise level systems ¨ Teach only the basics in SA&D – prepares students for advanced concepts when they get into industry ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 30
Detailed Interaction Diagrams n Two types ¨ Sequence Diagrams ¨ Collaboration Diagrams Use Case Driven (for each use case) n Show internal software objects that “collaborate” to execute a use case n Objects “collaborate” by sending messages to each other n ¨ Messages ISECON 2003 San Diego become method calls in OOP Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 31
Sequence Diagrams Same components as SSD n : System is exploded into internal objects n Activation Lifeline is a rectangular box on the object lifeline showing active “execution” n ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 32
ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 33
The Design Process n n Micro-level iterations (within a UP iteration) First cut at Design Class Diagram ¨ Type cast attributes ¨ Determine preliminary navigation visibility n Micro Iteration 1 ¨ With problem domain classes, develop sequence diagram n Micro iteration 2 (or more) ¨ Add view layer classes ¨ Add data access layer classes ¨ Add other service classes ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 34
Micro Iteration 1 n First – design with the problem domain classes ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 35
ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 36
Micro Iteration 2 n Second – Add view layer (<<boundary>>) classes ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 37
ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 38
Micro Iteration 2 or 3 n Third – Add data access layer classes ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 39
ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 40
ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 41
Advance Topics Design patterns n Statecharts for design n ¨ Method logic on transitions action expressions ¨ System wide states, menu design, system modes n Enterprise level design (multilayer, and many service components) ISECON 2003 San Diego Copyright © 2003 by R. B. Jackson and J. W. Satzinger All Rights Reserved 42
- Slides: 42