390 likes | 693 Views
Chapter 22 Object-Oriented Design. Object-Oriented Design. OOA and OOD. c. l. a. s. s. e. s. c. l. a. s. s. e. s. o. b. j. e. c. t. s. o. b. j. e. c. t. s. a. t. t. r. i. b. u. t. e. s. a. t. t. r. i. b. u. t. e. s. d. a. t. a. s. t. r. u.
E N D
c l a s s e s c l a s s e s o b j e c t s o b j e c t s a t t r i b u t e s a t t r i b u t e s d a t a s t r u c t u r e s d a t a s t r u c t u r e s m e t h o d s m e t h o d s a l g o r i t h m s a l g o r i t h m s r e l a t i o n s h i p s r e l a t i o n s h i p s m e s s a g i n g m e s s a g i n g b e h a v i o r b e h a v i o r c o n t r o l c o n t r o l OOA and OOD A n a l y s i s M o d e l D e s i g n M o d e l A n a l y s i s M o d e l D e s i g n M o d e l (design classes)
Design Issues • decomposability—facility where a design method helps designer to decompose a large problem to solve; • composability—degree to which a design method ensures that program components (modules), once designed and built, can be reused ; • understandability—ease with which a program component can be understood without reference to other information or other modules; • continuity—ability to make small changes in a program and have these changes manifest themselves with corresponding changes in just one or a very few modules; • protection— architectural characteristic reducing the propagation of side affects if errors occur in a module.
Generic Components for OOD • Problem domain component—the subsystems that are responsible for implementing customer requirements directly; • Human interaction component —the subsystems that implement the user interface (this included reusable GUI subsystems); • Task Management Component—the subsystems that are responsible for controlling and coordinating concurrent tasks that may be packaged within a subsystem or among different subsystems; • Data management component—the subsystem that is responsible for the storage and retrieval of objects.
System Design Process • Partition the analysis model into subsystems. • Identify concurrency that is dictated by the problem. • Allocate subsystems to processors and tasks. • Develop a design for the user interface. • Choose a basic strategy for implementing data management. • Identify global resources and the control mechanisms required to access them. • Design an appropriate control mechanism for the system, including task management. • Consider how boundary conditions should be handled. • Review and consider trade-offs.
Object Design • A protocol description establishes the interface of an object by defining each message that the object can receive and the related operation that the object performs • An implementation description shows implementation details for each operation implied by a message that is passed to an object. • information about the object's private part • internal details about the data structures that describe the object’s attributes • procedural details that describe operations
Object-Oriented Design • You text gave a very detailed description of structured design and how you can take a data flow diagram and migrate it to a program structure chart. . • Remember we censored that material. • You text does not afford OO design that same detailed description. • I will attempt to augment the text HERE.
Object-Oriented Design • WHAT WE HAVE – from the SRS • 1. Use Case Diagrams • 2. Process Diagrams for each major application process or applet (in our case just one) • 3. Class Diagrams showing the major classes of the system. • 4. State Transaction diagrams for each class.
Object-Oriented Design • WHAT WE NEED – for the SDS 1.General Architecture for the Design of the System including sub-systems, client server interfaces, and their related communications and allocations. 2. Design Class Diagrams showing the major classes of the system from a design perspective. 3. Use Case Diagrams denoting applets/applications with their supporting sequence diagrams.
Object-Oriented High-Level Design • High Level System Environmental Design • Level of Client/Server • What type machines at each level • Database software needed at each level • Communications software needed at each level • Communications hardware needed at each level • User Interface software proposed • Any needed middleware
Object-Oriented High-Level Design Client Server DB Server Environment Environment Environment Compaq Server NT Visual Basic MSMQ SNA Server (COMTI) Mainframe IBMXXX MVS CICS Cobol Programs Compaq PC NT Visual Basic ….. IMS Access SQL - 7 Crystal Reports Hand Readers Cameras VB Screens
Object-Oriented High-Level Design Client Server DB Server Environment Environment Environment SNA Server(COMTI) TCPIP CICS Trans T1 Line TCPIP MSMQ Messages T1/transactions Twisted Pair Compaq Server NT Visual Basic MSMQ SNA Server (COMTI) Mainframe IBMXXX MVS CICS Cobol Programs Compaq PC NT Visual Basic ….. IMS Access SQL - 7 Crystal Reports Hand Readers Cameras VB Screens
Object-Oriented Design • Once the High Level System Environmental Design is complete • You must: • Define the classes needed at each level • Define the use cases needed at each level. • This requires an iterative process
Object-Oriented High-Level Design Client Server DB Server Environment Environment Environment Thick/Thin Servlets ? Databases UI Database Classes
Class Diagrams Cassette cassetteID: int cassetteVolumeNo: int rentMovie() ClassName Video Rental System Multiplicity Customer 1..* 1..* attributes rents CID: int name: String authenticateCustomer () methods relationship
Design Class Diagrams • Domain classes (denoted in the analysis phase and reported on our SRS) • Interface classes for all external interfaces • Database/file classes for all persistent data • Concurrency classes for controlling concurrency • Analysis Patterns • Application Patterns • Design Pattern
Class Diagrams Movie Distributor distributorID: String Distributor Name: String ……. movieID: int movieName: String Customer orderMovie() trackOrder() CID: int name: String Cassette Rental cassetteID: int customerID: int dateRented: date cassetteID: int cassetteVolumeNo: int authenticateCustomer () rentMovie() rentMovie() Video Rental System – domain classes
Class Diagrams Movie Distributor Party distributorID: String Distributor Name: String ……. ……. movieID: int movieName: String Customer orderMovie() trackOrder() CID: int name: String Cassette Rental cassetteID: int customerID: int dateRented: date cassetteID: int cassetteVolumeNo: int authenticateCustomer () rentMovie() rentMovie() Video Rental System – analysis patterns
Class Diagrams Movie movieID: int movieName: String Rental View (s) Movie View(s) Party View(s) Party orderMovie() CID: int name: String CID: int name: String CID: int name: String authenticateCustomer () authenticateCustomer () authenticateCustomer () CID: int name: String Cassette Rental cassetteID: int customerID: int dateRented: date cassetteID: int cassetteVolumeNo: int authenticateCustomer () rentMovie() rentMovie() Video Rental System + interface classes
Class Diagrams Database Class Movie Movie Table movieID: int movieName: String Rental View (s) Movie View(s) Party View(s) Party orderMovie() CID: int name: String Cassette Rental cassetteID: int customerID: int dateRented: date cassetteID: int cassetteVolumeNo: int authenticateCustomer () rentMovie() rentMovie() Cassette Table Rental Table Party Table Video Rental System + database classes
Use Case Diagrams System Video Rental System Order new videos Use Case Rent video Corporate Enroll Customer Return video Actor Customer
Class Diagrams Database Class Rent Video Enroll Customer Return Video Movie Movie Table movieID: int movieName: String Rental View (s) Movie View(s) Party View(s) Party orderMovie() CID: int name: String Cassette Rental cassetteID: int customerID: int dateRented: date cassetteID: int cassetteVolumeNo: int authenticateCustomer () rentMovie() rentMovie() Cassette Table Rental Table Party Table Video Rental System + use case classes
Class Diagrams Database Class Return Video Enroll Customer Rent Video Rent Video View Movie Movie Table movieID: int movieName: String Rental View (s) Movie View(s) Party View(s) Party orderMovie() CID: int name: String Cassette Rental cassetteID: int customerID: int dateRented: date cassetteID: int cassetteVolumeNo: int authenticateCustomer () rentMovie() rentMovie() Cassette Table Rental Table Party Table Use case views Video Rental System + use case views
Class Diagrams Database Class Return Video Enroll Customer Rent Video Rent Video View Movie Movie Table movieID: int movieName: String Rent Video Ctrl Movie View(s) Rental View (s) Party View(s) Movie Ctrl Party Ctrl Rental Ctrl Party orderMovie() CID: int name: String Cassette Rental cassetteID: int customerID: int dateRented: date cassetteID: int cassetteVolumeNo: int authenticateCustomer () rentMovie() rentMovie() Cassette Table Rental Table Party Table Video Rental System + application patterns
Class Diagrams Database Class Return Video Enroll Customer Rent Video Rent Video View Movie Movie Table movieID: int movieName: String Rent Video Ctrl Movie View(s) Rental View (s) Party View(s) Movie Ctrl Party Ctrl Rental Ctrl Party orderMovie() CID: int name: String Cassette Rental cassetteID: int customerID: int dateRented: date cassetteID: int cassetteVolumeNo: int authenticateCustomer () rentMovie() rentMovie() Cassette Table Rental Table Party Table Video Rental System + application patterns
Class Diagrams Database Class Return Video Enroll Customer Rent Video Rent Video View Movie Movie Table movieID: int movieName: String Movie View(s) Party View(s) Rental View (s) Rent Video Ctrl Movie Ctrl Rental Ctrl Party Ctrl Party orderMovie() CID: int name: String Cassette Rental cassetteID: int customerID: int dateRented: date cassetteID: int cassetteVolumeNo: int authenticateCustomer () rentMovie() rentMovie() Cassette Table Rental Table Party Table Rental Report Video Rental System + application patterns
Class Diagrams Video Rental System + design patterns Rent video rental error msg produce error msg format read output invalid rental Calculate Rental fee trans Set Proce validate trans Types: Children Current Classic ….. determine type Set price calculate Rental fee …… format output
Class Diagrams Movie movieID: int movieName: String orderMovie() Current Movie Classic Movie Children Movie Video Rental System + design patterns Rent video
Class Diagrams Rent Video Movie movieID: int movieName: String orderMovie() Children Movie MovieFactoryIF MovieFactory Current Movie Classic Movie Factory Video Rental System + design patterns Rent video
Class Diagrams Rental Report Rent Video Linee ClassicLinee ChildrenLine MovieFactoryIF MovieFactory Report IF Report Builder CurrentLine Builder Video Rental System + design patterns Rent video
Use Case Diagrams System Video Rental System Order new videos Use Case Enroll Customer Corporate Rent video Return video Actor Customer