Download presentation
Presentation is loading. Please wait.
1
Slide 3.1 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. An Introduction to Object-Oriented Systems Analysis and Design with UML and the Unified Process McGraw-Hill, 2004 Stephen R. Schach srs@vuse.vanderbilt.edu
2
Slide 3.2 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CHAPTER 3 THE OBJECT-ORIENTED PARADIGM, UML, AND THE UNIFIED PROCESS
3
Slide 3.3 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter Overview l The Traditional Paradigm versus the Object-Oriented Paradigm l Objects and Classes l Inheritance l Generalization, Aggregation, and Association l Examples of UML Class Modeling l Information Hiding l The Unified Process l Iteration and Incrementation within the Unified Process
4
Slide 3.4 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Operations and Data l All programming languages perform operations on data l Example 1: Banking information system –Data: accountBalance –Operations: deposit withdraw
5
Slide 3.5 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Operations and Data (contd) l Example 2: Hospital information system –Data: patientName patientDateOfBirth patientGender –Operations: admitPatient dischargePatient updatePatientMedicalRecord
6
Slide 3.6 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Traditional versus Object-Oriented Paradigm l In the past, systems analysis was a creative skill –Individuality was highly prized l Around 1970, large computers became affordable –Information systems began to be developed by teams –A systematic approach was needed l The traditional methodology or traditional paradigm was developed –Also known as the structured methodology or structured paradigm
7
Slide 3.7 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Traditional v. Object-Oriented Paradigm (contd) l Initially, the traditional paradigm was successful –Any approach is better than no approach at all l During the 1980s –Larger computers became affordable –Information systems grew in size l But the larger the information system, the less successful the traditional paradigm was l What had gone wrong?
8
Slide 3.8 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Traditional v. Object-Oriented Paradigm (contd) l The traditional paradigm worked well with small- scale information systems –About 5,000 lines of code l But not with medium-scale information systems –About 50,000 lines of code l Or with large-scale information systems –At least 500,000 lines of code l Why?
9
Slide 3.9 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Traditional v. Object-Oriented Paradigm (contd) l Recall: The two basic building blocks of information systems are –Operations; and –Data l The traditional paradigm –Concentrates on operations; and –Largely ignores data l The object-oriented paradigm gives equal weight to operations and data
10
Slide 3.10 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. The Current Situation l Just how serious is the current situation? l Do we really need to adopt the object-oriented paradigm?
11
Slide 3.11 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. The Current Situation (contd) l Study of 280,000 projects completed in 2000 –Only about 1 in 4 was a success
12
Slide 3.12 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Legal Implications of the Current Situation l 2002 survey of information technology organizations –78% have been involved in disputes that ended in litigation l For the organizations that entered into litigation: –In 67% of the disputes, the functionality of the information system as delivered did not meet not up to the claims of the developers –In 56% of the disputes, the promised delivery date slipped several times –In 45% of the disputes, the defects were so severe that the information system was unusable
13
Slide 3.13 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Objects and Classes l Kings have something in common
14
Slide 3.14 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. King Class l Let the set of all kings be called King Class
15
Slide 3.15 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Classes and Objects l King George III is an instance of King Class, and so is King Louis XVI l A class is a set of related objects –Example: King Class is a set of kings l Conversely, an object is an instance of a class –Example: King George III is an instance of King Class
16
Slide 3.16 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Shoes l A shoe has a –Color (black, brown); –Size (3, 8 ½, 9½, 14); –Width (AAA, C, E); –Style (stiletto heel, wingtip, moccasin, penny loafer); and –Material (leather, plastic) l Color, size, width, style, and material are attributes of shoes
17
Slide 3.17 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Shoe Class l Shoe Class is the name of the set of all shoes
18
Slide 3.18 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. UML Notation for Classes l There are three boxes –Top box: Class name »Boldface With the Words in the Name Starting with Uppercase Letters –Middle box: Attributes –Lowest box: Operations l All the boxes are optional—see next slide
19
Slide 3.19 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Valid UML Representations of a Class
20
Slide 3.20 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. UML Convention for Objects l The name of an object is written in –boldface underlined but all in lowercase letters l Examples: –A king is an instance of King Class –A shoe is an instance of Shoe Class
21
Slide 3.21 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Inheritance l Example: Cardholder Clothing Company –The e-commerce company allows customers to purchase clothes using a credit card
22
Slide 3.22 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Inheritance (contd) l The information system must be extended to allow purchasers to charge purchases to a debit card l Credit and debit cards have many features in common, including attributes: –cardNumber; –nameOfCardholder; and –expirationDate l The major difference: –A credit card has a credit limit –A debit card has a current balance
23
Slide 3.23 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Inheritance (contd) l Make Debit Card Class and Credit Card Class special cases of a more general class, Bank Card Class
24
Slide 3.24 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Inheritance (contd) l The figure on the previous slide shows that: –Bank Card Class is a class –Credit Card Class is a subclass of Bank Card Class l The open triangle below Bank Card Class indicates that Credit Card Class inherits from Bank Card Class. This means that –Credit Card Class has all the features of Bank Card Class (the derived part) –It also has features of its own that are specific to Credit Card Class (the incremental part), such as a creditLimit
25
Slide 3.25 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Cardholder Clothing Company (contd) l The following statements are equivalent: –Credit Card Class is a subclass of Bank Card Class –Bank Card Class is a superclass of Credit Card Class –Credit Card Class is a specialization of Bank Card Class –Bank Card Class is a generalization of Credit Card Class –Credit Card Class is a Bank Card Class –Bank Card Class is the base class, Credit Card Class is the derived class –Bank Card Class is the parent class, Credit Card Class is the child class –Credit Card Class inherits from Bank Card Class
26
Slide 3.26 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Inheritance (contd) l Credit Card Class and Debit Card Class are both subclasses of class Bank Card Class
27
Slide 3.27 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Inheritance (contd) l The figure on the previous slides shows that: –Credit Card Class and Debit Card Class both inherit all the attributes and operations of Bank Card Class, such as »nameOfCardholder »validateTransaction l In addition, Credit Card Class and Debit Card Class can have attributes and operations of their own –For example: »Credit Card Class has attribute creditLimit »Debit Card Class has operation determineAccountBalance
28
Slide 3.28 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Inheritance (contd) l Inheritance is a required feature of object orientation –Therefore, every object-oriented programming language supports inheritance, including »Smalltalk »C++ »Ada 95 »Java
29
Slide 3.29 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Inheritance Hierarchy l Inheritance can involve more than two classes
30
Slide 3.30 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Relationships between Classes l Inheritance is an implementation of the generalization relationship l Other possible relationships between classes include –Aggregation –Association These two relationships are now described
31
Slide 3.31 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Aggregation l Example: A car is constructed from a chassis, engine, wheels, and seats
32
Slide 3.32 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Aggregation (contd) l The aggregation relationship is appropriate when class X “consists of” classes Y and Z l In UML, aggregation is represented by an open diamond –See the figure in the previous slide
33
Slide 3.33 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Association l Association is an arbitrary relationship between two classes l Example: A radiologist may consult a lawyer regarding the interpretation of a contract –The solid triangle points from the radiologist to the lawyer
34
Slide 3.34 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Association l Example: A lawyer with a broken leg consults a radiologist –The solid triangle points in the other direction l Using the solid triangle in this way is called navigation in UML
35
Slide 3.35 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. UML Modeling Example: Ice-Cream Factories l Three equally valid UML class diagrams Ice Cream Factory Class
36
Slide 3.36 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. UML Modeling Example: Human Beings. 1
37
Slide 3.37 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. UML Modeling Example: Human Beings. 2
38
Slide 3.38 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. UML Modeling Example: Human Beings. 3
39
Slide 3.39 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Alternative Models l How can all three models all be correct? –Each model highlights different aspects l Information systems can be modeled in a number of different but equally correct ways –The systems analyst must decide which model is the most appropriate
40
Slide 3.40 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Systems Analysts Listening to the Radio l At first sight there is no connection between systems analysts and radios –Model using association –The black triangle is superfluous but is good UML practice
41
Slide 3.41 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Information Hiding l Information hiding enhances maintainability – Implementation details are invisible outside an object l Example: Bank Account Class –Attribute accountBalance can be implemented in many different ways: »As an integer (the total amount in cents); or »As a dollar amount with two decimal places for the cents –With information hiding, these details are invisible l Object-oriented languages allow an attribute to be described as private (invisible outside the object)
42
Slide 3.42 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Information Hiding (contd) l For example, suppose that the two operations of Bank Account Class are deposit and withdraw l The only way of changing the accountBalance of a bank account object is –To send a message to deposit or withdraw
43
Slide 3.43 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Information Hiding (contd) l Why do we do this? –Surely it is easier to modify accountBalance directly? l When we change the way accountBalance is implemented –If we have information hiding, this change cannot affect any other part of the information system l When there is information hiding, there cannot be regression faults –A regression fault is a fault in one part of the code caused by a change in an apparently unrelated part of the code
44
Slide 3.44 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Information Hiding (contd) l With information hiding –A system consists of essentially independent classes –They communicate by sending messages l A private attribute –Can be accessed only from inside the class in which is declared l A public attribute –Can be accessed from anywhere inside the information system l The same rules apply to operations
45
Slide 3.45 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Example: Bank Account Class l public operations deposit and withdraw can be invoked from anywhere in the information system l The only way to change the value of private attribute accountBalance is to invoke those two operations
46
Slide 3.46 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Responsibility-Driven Design l Responsibility-driven design goes beyond information hiding –Total responsibility for carrying out all aspects of the message rests with the object receiving the message l Example: 1–800–flowers.com –It is irrelevant where 1–800–flowers.com is located –It is irrelevant which florist will be given your order to deliver –The company will not divulge that information (information hiding)
47
Slide 3.47 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. The Unified Process l As pointed out earlier in this chapter: –There are problems when the traditional paradigm is used with medium- and large-scale information systems –The object-oriented paradigm solved these problems l Between 1985 and 1995, over 50 different object- oriented methodologies were published –Three of the most successful were »Booch’s method »Jacobson’s Objectory »Rumbaugh’s OMT
48
Slide 3.48 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. The Unified Process (contd) l Booch, Jacobson, and Rumbaugh published a complete object-oriented analysis and design methodology that unified their three separate methodologies –Original name: Rational Unified Process (RUP) –Next name: Unified Software Development Process (USDP) –Name used today: Unified Process (for brevity)
49
Slide 3.49 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. The Unified Process (contd) l The Unified Process is not a series of steps for constructing an information system –No such single “one size fits all” methodology could exist –There is such a wide variety of different types of information systems l The Unified Process is an adaptable methodology –It has to be modified for the specific information system to be developed
50
Slide 3.50 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. The Unified Process (contd) l The version of the Unified Process in this book is for –Information systems small enough to be developed by a team of three students during the semester or quarter l However, the modifications for developing a large information system are also discussed l The goals of this book: –A thorough understanding of how to develop smaller information systems –An appreciation of the issues that need to be addressed when larger information systems are constructed
51
Slide 3.51 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. The Unified Process (contd) l The Unified Process is a modeling technique –A model is a set of UML diagrams that represent various aspects of the information system we want to develop l UML stands for unified modeling language –UML is the tool that we use to represent (model) the target information system
52
Slide 3.52 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. The Unified Process (contd) l UML is graphical –A picture is worth a thousand words l UML diagrams enable information technology professionals to communicate quickly and accurately
53
Slide 3.53 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Iteration and Incrementation l The Unified Process is iterative and incremental –This is a consequence of Miller’s Law (see Chapter 2) l Each workflow consists of a number of steps –The steps are repeated until the UML model is accurate l We can never get the object-oriented analysis and design right the first time
54
Slide 3.54 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. The Complete Unified Process l We cannot learn the complete Unified Process in one semester or quarter –Extensive study and unending practice are needed –The Unified Process has too many features –A case study of a large-scale information system is huge
55
Slide 3.55 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. The Complete Unified Process (contd) l In this book, we therefore cover most, but not all, of the Unified Process –The topics covered are adequate for smaller systems l To work on larger systems, experience is needed –This must be followed by training in the more complicated aspects of the Unified Process
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.