You are on page 1of 27

Chapter 20 Object-Oriented Analysis and Design

Chapter Overview
The purpose of Chapter 20 is to introduce students to object-oriented analysis and design (OOAD). OOADs increasing popularity is brought about in part because of its ability to represent complex relationships, as well as data and data processing, with a consistent notation. Students are introduced to several techniques and notations that systems analysts use to perform object-oriented analysis and design, including use case diagrams, class diagrams, state diagrams, sequence diagrams, activity diagrams, component diagrams, and deployment diagrams. The standard object-oriented language, UML, is used to present these techniques and notations. The chapter begins with a comparison of the object-oriented development life cycle and the traditional development life cycle. The object-oriented development life cycle consists of three primary phases: analysis, design, and implementation. An object representation will develop as it moves through each of these phases. After a brief introduction to UML, students are shown how to prepare the diagrams mentioned above. This chapter concludes with a discussion of these various diagramming techniques and their use in analysis and design.

Instructional Objectives
Specific student learning objectives are included at the beginning of the chapter. From an instructors point of view, the objectives of this chapter are to: 1. Discuss the similarities and differences between the object-oriented development life cycle and the more traditional systems development life cycle. 2. Show the similarities and differences between object-oriented analysis and design and more traditional, structured systems analysis and design notations and methods. 3. Reinforce the terminology utilized in this chapter. 4. Discuss when each of the modeling techniques is utilized in the object-oriented development life cycle. 5. Show students how to construct each of the models presented in the chapter. 6. Show and discuss how the models are related to each other.

Classroom Ideas
1. An object-oriented (OO) specification can become very extensive since all aspects are integrated into one model, so you will need to use simple examples. After briefly reviewing OOAD terminology and notation, it is recommend that you teach from examples for the rest

222

Modern Systems Analysis and Design, 3rd edition

Instructors Manual

of the class. The situations described in Problem and Exercise 6 are suitable to work in class. Experience has shown that the greatest discussion centers around what methods should exist and where they should be located (that is, with what object). 2. It is essential that students have a sound understanding of the core concepts of OOAD: object, class, encapsulation, inheritance, and to some extent polymorphism. Be sure students can distinguish an object from a data entity instance and a class from an entity type. Emphasize the ramifications of encapsulation for systems development, which deal primarily with decoupling system components. 3. Compare and contrast the OOAD phases with the traditional SDLC phases. Stress to the students that in the beginning the model is abstract, showing more detail as it moves through the OOAD phases. The text uses a good analogy; OOAD resembles more of an onion than a waterfall. 4. If you have access to practicing systems analysts, invite these analysts to your class to discuss their usage of OOAD. 5. Stress the benefits of OOAD, especially the increased consistency among the models developed during object-oriented analysis and design. 6. For some students this is their first exposure to object-oriented analysis and design. One way to approach the presentation of this material is to make heavy use of the figures and illustrations utilized in the chapter. Use these figures and illustrations to reinforce the terminology and diagramming rules presented in the text. 7. An interesting exercise for the students involves the use of Figures 20-20 and 20-21. As a class discussion or group exercise, ask the students to discuss how these diagrams should be modified (if at all) to accommodate transfer students from other universities or junior colleges. 8. Review Question 1 is a good tool for comparing and contrasting the terminology presented in this chapter. 10. You can supplement your lecture with the video segment, Montgomery County Building Permit System: An Object-Oriented Analysis Design Project. This video segment is about 16 minutes long. Notes on using this video segment are included in a separate section of this instructors manual. Please see the Preface to this instructors manual for information on how to obtain this and other video segments produced for use with the third edition of Modern Systems Analysis and Design.

223

Chapter 20

Object-Oriented Analysis and Design

Answers to Key Terms


Suggested answers are provided below. These answers are presented top-down, left to right. 5. 39. 40. 23. 34. 11. 24. 12. 25. 26. 18. 17. 30. 38. 7. 31. 9. 22. 8. 1. Actor Use case Use-case diagram Object State Behavior Object class (class) Class diagram Object diagram Operation Encapsulation Constructor operation Query operation Update operation Association Scope operation Association role Multiplicity Association class Abstract class 16. 13. 2. 20. 29. 27. 21. 6. 15. 36. 19. 35. 32. 3. 37. 33. 10. 4. 28. 14. Concrete class Class-scope attribute Abstract operation Method Polymorphism Overriding Multiple classification Aggregation Composition State transition Event State diagram Sequence diagram Activation Synchronous message Simple message Asynchronous message Activity diagram Package Component diagram

Answers to Review Questions


1. A use case represents a sequence of related actions that have been initiated by an actor. An actor is an external entity that interacts with the system. An extends relationship extends or adds to a use case by adding new relationships. For example, the Class Registration use case can function fine on its own; however, in certain circumstances, additional actions will need to be performed, such as registering a student for a special class, thus requiring an extension use case. However, when one use case requires the use of another use case while executing then a uses (or includes) relationship is appropriate. An object, or object instance, refers to an individual object; an object class refers to a set of objects that share a common structure and a common behavior. Jacob James and Colby Michael are both object instances. Employee is an example of an object class. An attribute is a property of an object; an operation is a function or a service that is provided by all the instances of a class.

224

Modern Systems Analysis and Design, 3rd edition

Instructors Manual

An objects state encompasses an objects properties and the values those properties have. An objects behavior represents how an object acts and reacts. The objects behavior is dependent on the objects state and the operation being performed. An operation is a function or a service that is provided by all the instances of a class. The method is the actual implementation of the operation. A query operation accesses the state of an object but does not alter the state; however, an update operation alters the state of an object. An abstract class is a class that has no direct instances, but whose descendants may have direct instances. A concrete class is a class that can have direct instances. A class diagram shows the static structure of an object-oriented model: the object classes, their internal structure, and the relationships in which they participate. An object diagram is a graph of instances that are compatible with a given class diagram. An association is a relationship among instances of object classes. An aggregation is a stronger form of association, representing a part-of relationship between a component object and an aggregate object. Generalization abstracts common features among multiple classes, as well as the relationships in which they participate. Aggregation is a part-of relationship between a component object and an aggregate object. While aggregation involves a set of distinct object instances, generalization relates object classes. Aggregation refers to a part-of relationship between a component object and an aggregate object. Composition is a stronger form of aggregation, referring to a part object that belongs to only one whole object, and that lives and dies with the whole object. Overriding by extension occurs when an operation inherited by a subclass is extended by adding some behavior; however, in contrast, overriding by restriction occurs when the inherited operation is restricted or tightened by a new operation. As it relates to state diagrams, a state is a condition during the life of an object during which it satisfies some condition, performs some action, or waits for some event. An event is something that takes place at a certain point in time. An event changes an objects state. An event is something that takes place at a certain point in time; as a result of that event, an action occurs. An entry action is performed upon entering a state; an exit action is performed when leaving a state. A state diagram is a model of the states of an object and the events that cause the object to change from one state to another. A sequence diagram depicts the interactions among objects during a certain period of time. A generic sequence diagram shows all possible sequences corresponding to all the scenarios of a use case. An instance sequence diagram shows the sequence for one scenario.

225

Chapter 20

Object-Oriented Analysis and Design

A synchronous message is a type of message in which the caller has to wait for the receiving object to finish executing the called operation before it can resume execution itself. An asynchronous message is a type of message in which the sender does not have to wait for the recipient to handle the message. A sequence diagram depicts the interactions among objects during a certain period of time. An activity diagram shows the conditional logic for the sequence of system activities needed to accomplish a business process. 2. The object-oriented development life cycle involves developing an object through analysis, design, and implementation phases. As the model develops, its focus shifts from an external, abstract focus to one that is more detailed and internally focused. Object-oriented analysis focuses on what the new system should do, not how it will function. During this phase, a model of the real-world application is developed showing its important properties. During object-oriented design, the analyst will specify how the application-oriented model will be realized in the implementation environment. This necessitates research into the impact that the implementation environment will have on the design. The design phase consists of two subphases: system design and object design. During system design, the system designer proposes a system architecture. During object design, a design model is built by adding implementation features. During the implementation phase, the design is implemented via a programming language or DBMS. 3. The biggest difference between the models is that the object-oriented models build on each other, are consistent, and use a consistent notation. Models developed during structured analysis and design are weakly connected and lack a common representation. 4. An extends relationship is used when a use case requires the addition of new behaviors or actions. The use case is always performed, regardless of whether the extension use case is performed. 5. The include relationship is necessitated when a use case requires (uses) another use case while executing. In this situation, a specialized use case uses a generalized case. 6. Assume your universitys employment system hires new faculty and when eligible, promotes current faculty members to higher academic ranks. Hiring new employees and promoting current faculty are specialized use cases. As part of the hiring or promotion process, the individuals vita is evaluated. So, the evaluate vita use case is an abstract case. 7. When an association has attributes, operations, or participates in relationships of its own, the association should be modeled as an association class.

226

Modern Systems Analysis and Design, 3rd edition

Instructors Manual

8. Suggested answers are provided below. Relationship Examples Class Diagrams

9. Suggested answers are provided below. Role Names Added to Examples Class Diagrams

227

Chapter 20

Object-Oriented Analysis and Design

10. Suggested answers are provided below. Operations Added to Examples Class Diagrams

11. A suggested answer is provided below. Generalization Example

228

Modern Systems Analysis and Design, 3rd edition

Instructors Manual

12. Since students will provide a variety of examples, their answers to this question will vary. The example provided in the previous answer does contain an abstract class. 13. Polymorphism means that the same operation may apply to two or more classes in different ways. One example is if the method that implements the computePay operation adds certain benefits, such as retirement, for the salaried employee. 14. One example of aggregation is a vehicle. A vehicle will have front and side air bags, an air conditioner, an engine, tires, possibly a trunk, and other components. 15. A suggested answer is provided below. Game State Diagram

229

Chapter 20

Object-Oriented Analysis and Design

Answers to Problems and Exercises


1. A suggested answer is provided below. University Registration Use Case Diagram

230

Modern Systems Analysis and Design, 3rd edition

Instructors Manual

2. A suggested answer is provided below. University Registration Use Case Diagram (Modified)

231

Chapter 20

Object-Oriented Analysis and Design

3. A suggested answer is provided below. Auto Rental Company Use Case Diagram

232

Modern Systems Analysis and Design, 3rd edition

Instructors Manual

4. A suggested answer is provided below. Faculty Tenure Review Use Case Diagram

233

Chapter 20

Object-Oriented Analysis and Design

5. A suggested answer is provided below. Auto Rental Company Class Diagram

6. Suggested answers are provided below. Company Class Diagram

234

Modern Systems Analysis and Design, 3rd edition

Instructors Manual

University Course Catalog Class Diagram

Laboratory Class Diagram

235

Chapter 20

Object-Oriented Analysis and Design

College Course Class Diagram

Hospital Class Diagram

7. A suggested answer is provided below. Student Activity Class Diagram

236

Modern Systems Analysis and Design, 3rd edition

Instructors Manual

8. A suggested answer is provided below. Sports Team Class Diagram

237

Chapter 20

Object-Oriented Analysis and Design

9. Suggested answers are provided below. Stillwater Antiques Use Case Diagram

Stillwater Antiques Class Diagram

238

Modern Systems Analysis and Design, 3rd edition

Instructors Manual

10. Suggested answers are provided below. H. I. Topi School of Business Use Case Diagram

239

Chapter 20

Object-Oriented Analysis and Design

H. I. Topi School of Business Class Diagram

11. A suggested answer is provided below. Nonprofit Organization Class Diagram

240

Modern Systems Analysis and Design, 3rd edition

Instructors Manual

12. A suggested answer is provided below. Bank Account Class Diagram

241

Chapter 20

Object-Oriented Analysis and Design

13. Suggested answers are provided below. Registration and Title Class Diagram

242

Modern Systems Analysis and Design, 3rd edition

Instructors Manual

Registration and Title State Diagram

243

Chapter 20

Object-Oriented Analysis and Design

Registration and Title Nested State Diagram

244

Modern Systems Analysis and Design, 3rd edition

Instructors Manual

Registration Renewal Notice Sequence Diagram

245

Chapter 20

Object-Oriented Analysis and Design

14. A suggested answer is provided below. Auto Rental State Diagram

246

Modern Systems Analysis and Design, 3rd edition

Instructors Manual

15. This is a good exercise to assign in conjunction with Problems and Exercises 3 and 14. Your students will need to make several assumptions about this exercise. For their scenario, your students should decide whether the customer is a corporate or individual customer. If the customer is a corporate customer, then most likely the corporate customer will have information on file with the rental company, necessitating an object on the sequence diagram. You should ask your students to provide any assumptions that they make to you in written form. In its simplest interpretation, the diagram will have reservation, reservation entry, and available car objects appearing on the sequence diagram. 16. This is a good exercise for comparing and contrasting data flow diagrams with activity diagrams. Activity diagrams show the conditional logic for the sequence of system activities needed to accomplish a business process; data flow diagrams illustrate the flow of data between external entities and the processes and data stores within a system. In contrast to data flow diagrams, activity diagrams associate an activity with the organizational unit, show time (without a time scale), and sequence. A suggested answer is provided below. Hiring Process Activity Diagram

247

Chapter 20

Object-Oriented Analysis and Design

Guidelines for Using the Field Exercises


1. An example of superclass/subclass relationship is with equity securities. Equity securities represent ownership shares in a corporation. Equity securities have attributes such as name, symbol, exchange and price. A particular type of equity security is common stock. Preferred stock is another type equity security that offers the holders fixed dividends each year. An attribute for preferred stock would be dividend rate.

2. Examples of superclass/subclass relationships should be available in both service and manufacturing businesses. In service organizations you will find several classes of employees, ranging from part-time to full time with benefits. In manufacturing you might find several types of engineers (electrical, mechanical, etc.). Numerous operational business rules can be found in both types of businesses. In manufacturing, rules regarding quality standards and how overhead is allocated to jobs are found. In the service industry, rules related to processes, such as how an item is purchased, are found. 3. The translation of the EER (or E-R) diagram should map the entity types and attributes into classes. EER diagrams can represent generalizations that also map to class diagrams. EER and E-R notation is different than UML. Association relationships remain the same. E-R diagrams usually show keys. Keys can be represented with class attribute names followed by the {key} notation. The main differences will most likely be in the notation used to describe the model. Students may find systems analysts using Booch, OMT, or their own custom notation. Students should see if the notations in use could represent use cases.

4.

248