DEV475 Mastering Object-Oriented Analysis and Design with UML ...
DEV475 Mastering Object-Oriented Analysis and Design with UML ... DEV475 Mastering Object-Oriented Analysis and Design with UML ...
DEV475 Mastering Object-Oriented Analysis and Design with UMLExample: What Gets InheritedExample: What Gets InheritedSuperclass(Parent)GroundVehicle+ owner0..* 1PersongeneralizationCarTruckTrailerSubclass(Child)Mastering Object Oriented Analysis and Design with UMLCopyright © 2003 Rational Software, all rights reserved 48In the above example, a truck is defined as a vehicle with tonnage and a car is avehicle with a size (for example, compact or mid-size).Specifically, attributes:• A GroundVehicle has two attributes: weight and licenseNumber• A Car has three attributes: licenseNumber, weight, and size• A Truck has three attributes: licenseNumber, weight, and tonnageOperations:• A GroundVehicle has one operation: register()• A Car has one operation: register()• A Truck has two operations: register() and getTax()Relationships:• A Car is related to a Person (the owner)• A Truck is related to a Person (the owner)• A Truck also has a Trailer and is related to a Person (the owner)2 - 48
Module 2 - Concepts of Object OrientationWhat Is Realization?What Is Realization?• One classifier serves as the contract that the otherclassifier agrees to carry out, found between:• Interfaces and the classifiers that realize themComponentInterfaceClassInterfaceSubsystemInterface• Use cases and the collaborations that realize themCollaborationUseCaseMastering Object Oriented Analysis and Design with UMLCopyright © 2003 Rational Software, all rights reserved 49Realization is a semantic relationship between two classifiers. One classifier serves asthe contract that the other classifier agrees to carry out.The realizes relationship is a combination of a dependency and a generalization. It isnot true generalization, as only the “contract” (that is to say, operation signature) is“inherited.” This “mix” is represented in its UML form, which is a combination ofdependency and generalization.The realizes relationship may be modeled as a dashed line with a hollow arrowheadpointing at the contract classifier (canonical form), or when combined with aninterface, as a “lollipop” (elided form).Again, from The Random House Collegiate Dictionary:• Elide: to pass over; omit; ignore.• Canonical: authorized; recognized; accepted.2 - 49
- Page 60 and 61: DEV475 Mastering Object-Oriented An
- Page 62 and 63: DEV475 Mastering Object-Oriented An
- Page 64 and 65: DEV475 Mastering Object-Oriented An
- Page 66 and 67: DEV475 Mastering Object-Oriented An
- Page 68 and 69: DEV475 Mastering Object-Oriented An
- Page 70 and 71: DEV475 Mastering Object-Oriented An
- Page 72 and 73: DEV475 Mastering Object-Oriented An
- Page 74 and 75: DEV475 Mastering Object-Oriented An
- Page 76 and 77: DEV475 Mastering Object-Oriented An
- Page 78 and 79: DEV475 Mastering Object-Oriented An
- Page 80 and 81: DEV475 Mastering Object-Oriented An
- Page 82 and 83: DEV475 Mastering Object-Oriented An
- Page 84 and 85: DEV475 Mastering Object-Oriented An
- Page 86 and 87: DEV475 Mastering Object-Oriented An
- Page 88 and 89: DEV475 Mastering Object-Oriented An
- Page 90 and 91: DEV475 Mastering Object-Oriented An
- Page 92 and 93: DEV475 Mastering Object-Oriented An
- Page 94 and 95: DEV475 Mastering Object-Oriented An
- Page 96 and 97: DEV475 Mastering Object-Oriented An
- Page 98 and 99: DEV475 Mastering Object-Oriented An
- Page 100 and 101: DEV475 Mastering Object-Oriented An
- Page 102 and 103: DEV475 Mastering Object-Oriented An
- Page 104 and 105: DEV475 Mastering Object-Oriented An
- Page 106 and 107: DEV475 Mastering Object-Oriented An
- Page 108 and 109: DEV475 Mastering Object-Oriented An
- Page 112 and 113: DEV475 Mastering Object-Oriented An
- Page 114 and 115: DEV475 Mastering Object-Oriented An
- Page 116 and 117: DEV475 Mastering Object-Oriented An
- Page 118 and 119: DEV475 Mastering Object-Oriented An
- Page 120 and 121: DEV475 Mastering Object-Oriented An
- Page 122 and 123: DEV475 Mastering Object-Oriented An
- Page 124 and 125: DEV475 Mastering Object-Oriented An
- Page 126 and 127: DEV475 Mastering Object-Oriented An
- Page 128 and 129: DEV475 Mastering Object-Oriented An
- Page 130 and 131: DEV475 Mastering Object-Oriented An
- Page 132 and 133: DEV475 Mastering Object-Oriented An
- Page 134 and 135: DEV475 Mastering Object-Oriented An
- Page 136 and 137: DEV475 Mastering Object-Oriented An
- Page 138 and 139: DEV475 Mastering Object-Oriented An
- Page 140 and 141: DEV475 Mastering Object-Oriented An
- Page 142 and 143: DEV475 Mastering Object-Oriented An
- Page 144 and 145: DEV475 Mastering Object-Oriented An
- Page 146 and 147: DEV475 Mastering Object-Oriented An
- Page 148 and 149: DEV475 Mastering Object-Oriented An
- Page 150 and 151: DEV475 Mastering Object-Oriented An
- Page 152 and 153: DEV475 Mastering Object-Oriented An
- Page 154 and 155: DEV475 Mastering Object-Oriented An
- Page 156 and 157: DEV475 Mastering Object-Oriented An
- Page 158 and 159: DEV475 Mastering Object-Oriented An
<strong>DEV475</strong> <strong>Mastering</strong> <strong>Object</strong>-<strong>Oriented</strong> <strong>Analysis</strong> <strong>and</strong> <strong>Design</strong> <strong>with</strong> <strong>UML</strong>Example: What Gets InheritedExample: What Gets InheritedSuperclass(Parent)GroundVehicle+ owner0..* 1PersongeneralizationCarTruckTrailerSubclass(Child)<strong>Mastering</strong> <strong>Object</strong> <strong>Oriented</strong> <strong>Analysis</strong> <strong>and</strong> <strong>Design</strong> <strong>with</strong> <strong>UML</strong>Copyright © 2003 Rational Software, all rights reserved 48In the above example, a truck is defined as a vehicle <strong>with</strong> tonnage <strong>and</strong> a car is avehicle <strong>with</strong> a size (for example, compact or mid-size).Specifically, attributes:• A GroundVehicle has two attributes: weight <strong>and</strong> licenseNumber• A Car has three attributes: licenseNumber, weight, <strong>and</strong> size• A Truck has three attributes: licenseNumber, weight, <strong>and</strong> tonnageOperations:• A GroundVehicle has one operation: register()• A Car has one operation: register()• A Truck has two operations: register() <strong>and</strong> getTax()Relationships:• A Car is related to a Person (the owner)• A Truck is related to a Person (the owner)• A Truck also has a Trailer <strong>and</strong> is related to a Person (the owner)2 - 48