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 UMLFinding RelationshipsFinding RelationshipsPerformResponsibilityCollaborationDiagram:Client:SupplierClientLinkSupplierClassDiagramClient 0..*0..*Prime suppliersAssociationSupplierPerformResponsibility()Relationship for every link!Mastering Object Oriented Analysis and Design with UMLCopyright © 2003 Rational Software, all rights reserved 44To find relationships, start studying the links in the Collaboration diagrams. Linksbetween classes indicate that objects of the two classes need to communicate withone another to perform the use case. Thus, an association or an aggregation isneeded between the associated classes.Reflexive links do not need to be instances of reflexive relationships; an object cansend messages to itself. A reflexive relationship is needed when two different objectsof the same class need to communicate.The navigability of the relationship should support the required message direction. Inthe above example, if navigability was not defined from the Client to the Supplier,then the PerformResponsibility message could not be sent from the Client to theSupplier.Focus only on associations needed to realize the use cases; do not add associationsyou think "might" exist unless they are required based on the Interaction diagrams.Remember to give the associations role names and multiplicities. You can alsospecify navigability, although this will be refined in Class Design.Write a brief description of the association to indicate how the association is used, orwhat relationships the association represents.6 - 44
Module 6 - Use-Case AnalysisReview: What Is Aggregation?Review: What Is Aggregation?• A special form of association that models awhole-part relationship between anaggregate (the whole) and its partsWhole/aggregatePartStudent10..*Schedule0..* 0..2 CourseOfferingMastering Object Oriented Analysis and Design with UMLCopyright © 2003 Rational Software, all rights reserved 45Aggregation is a stronger form of association which is used to model a whole-partrelationship between model elements. The whole/aggregate has an aggregationassociation to the its constituent parts. A hollow diamond is attached to the end of anassociation path on the side of the aggregate (the whole) to indicate aggregation.Since aggregation is a special form of association, the use of multiplicity, roles,navigation, and so forth is the same as for association.Sometimes a class may be aggregated with itself. This does not mean that an instanceof that class is composed of itself (that would be silly). Instead, it means that oneinstance if the class is an aggregate composed of other instances of the same class.Some situations where aggregation may be appropriate include:• An object is physically composed of other objects (for example, car beingphysically composed of an engine and four wheels).• An object is a logical collection of other objects (for example, a family is acollection of parents and children).• An object physically contains other objects (for example, an airplane physicallycontains a pilot).In the example on the slide, the relationship from Student to Schedule is modeled asan aggregation, because a Schedule is inherently tied to a particular Student. ASchedule outside of the context of a Student makes no sense in this CourseRegistration System. The relationship from Schedule to CourseOffering is anassociation because CourseOfferings may appear on multiple Schedules.6 - 45
- Page 202 and 203: DEV475 Mastering Object-Oriented An
- Page 204 and 205: DEV475 Mastering Object-Oriented An
- Page 206 and 207: DEV475 Mastering Object-Oriented An
- Page 208 and 209: DEV475 Mastering Object-Oriented An
- Page 210 and 211: DEV475 Mastering Object-Oriented An
- Page 212 and 213: DEV475 Mastering Object-Oriented An
- Page 214 and 215: DEV475 Mastering Object-Oriented An
- Page 216 and 217: DEV475 Mastering Object-Oriented An
- Page 218 and 219: DEV475 Mastering Object-Oriented An
- Page 220 and 221: DEV475 Mastering Object-Oriented An
- Page 222 and 223: DEV475 Mastering Object-Oriented An
- Page 224 and 225: DEV475 Mastering Object-Oriented An
- Page 226 and 227: DEV475 Mastering Object-Oriented An
- Page 228 and 229: DEV475 Mastering Object-Oriented An
- Page 230 and 231: DEV475 Mastering Object-Oriented An
- Page 232 and 233: DEV475 Mastering Object-Oriented An
- Page 234 and 235: DEV475 Mastering Object-Oriented An
- Page 236 and 237: DEV475 Mastering Object-Oriented An
- Page 238 and 239: DEV475 Mastering Object-Oriented An
- Page 240 and 241: DEV475 Mastering Object-Oriented An
- Page 242 and 243: DEV475 Mastering Object-Oriented An
- Page 244 and 245: DEV475 Mastering Object-Oriented An
- Page 246 and 247: DEV475 Mastering Object-Oriented An
- Page 248 and 249: DEV475 Mastering Object-Oriented An
- Page 250 and 251: DEV475 Mastering Object-Oriented An
- Page 254 and 255: DEV475 Mastering Object-Oriented An
- Page 256 and 257: DEV475 Mastering Object-Oriented An
- Page 258 and 259: DEV475 Mastering Object-Oriented An
- Page 260 and 261: DEV475 Mastering Object-Oriented An
- Page 262 and 263: DEV475 Mastering Object-Oriented An
- Page 264 and 265: DEV475 Mastering Object-Oriented An
- Page 266 and 267: DEV475 Mastering Object-Oriented An
- Page 268 and 269: DEV475 Mastering Object-Oriented An
- Page 270 and 271: DEV475 Mastering Object-Oriented An
- Page 272 and 273: DEV475 Mastering Object-Oriented An
- Page 274 and 275: DEV475 Mastering Object-Oriented An
- Page 276: 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>Finding RelationshipsFinding RelationshipsPerformResponsibilityCollaborationDiagram:Client:SupplierClientLinkSupplierClassDiagramClient 0..*0..*Prime suppliersAssociationSupplierPerformResponsibility()Relationship for every link!<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 44To find relationships, start studying the links in the Collaboration diagrams. Linksbetween classes indicate that objects of the two classes need to communicate <strong>with</strong>one another to perform the use case. Thus, an association or an aggregation isneeded between the associated classes.Reflexive links do not need to be instances of reflexive relationships; an object cansend messages to itself. A reflexive relationship is needed when two different objectsof the same class need to communicate.The navigability of the relationship should support the required message direction. Inthe above example, if navigability was not defined from the Client to the Supplier,then the PerformResponsibility message could not be sent from the Client to theSupplier.Focus only on associations needed to realize the use cases; do not add associationsyou think "might" exist unless they are required based on the Interaction diagrams.Remember to give the associations role names <strong>and</strong> multiplicities. You can alsospecify navigability, although this will be refined in Class <strong>Design</strong>.Write a brief description of the association to indicate how the association is used, orwhat relationships the association represents.6 - 44