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 UMLReview: MultiplicityReview: MultiplicityUnspecifiedExactly OneZero or MoreZero or MoreOne or MoreZero or One (optional scalar role)Specified RangeMultiple, Disjoint Ranges10..**1..*0..12..42, 4..6Mastering Object Oriented Analysis and Design with UMLCopyright © 2003 Rational Software, all rights reserved 48For each role you can specify the multiplicity of its class. Multiplicity is the number ofobjects of the class that can be associated with one object of the other class.Multiplicity is indicated by a text expression on the association line. The expression isa comma-separated list of integer ranges. A range is indicated by an integer (the lowervalue), two dots, and an integer (the upper value). A single integer is a valid range.You may also specify narrower limits such as 2..4.During Analysis, assume a multiplicity of 0..* (zero to many) unless there is someclear evidence of something else.A multiplicity of zero implies that the association is optional. When you use thisnotation, make sure this is what you mean. If an object might not be there,operations that use the association will have to adjust accordingly.Within multiplicity ranges, probabilities may be specified. Thus, if the multiplicity is0..*, and is expected to be between 10 and 20 in 85% of the cases, make note of it.This information will be of great importance during Design. For example, if persistentstorage is to be implemented using a relational database, narrower limits will helpbetter organize the database tables.6 - 48
Module 6 - Use-Case AnalysisWhat Does Multiplicity Mean?What Does Multiplicity Mean?• Multiplicity answers two questions:• Is the association mandatory or optional?• What is the minimum and maximum number ofinstances that can be linked to one instance?CourseOffering0..* 1Course0..*preRequisites 0..3Mastering Object Oriented Analysis and Design with UMLCopyright © 2003 Rational Software, all rights reserved 49• Multiplicity lets you know the lower and the upper bound number ofrelationships that a given object can have with another object. Many times youdo not know what the maximum number of instances may be, and you will usethe “*” to specify that this number is unknown.• The most important question that multiplicity answers: Is the association ismandatory? A lower bound number that is greater than zero indicates that therelationship is mandatory.• This example indicates that a course object can be related to zero or more courseofferings. You can tell that the relationship is optional because the lower boundnumber is zero. The upper bound number of the relationship is unknown, asindicated by the “*”. If you read the association the other way, you will see that agiven course offering object can be related to only one course. This relationship ismandatory and indicates that it is not possible for a course offering object to existwithout an associated course object.6 - 49
- 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 252 and 253: DEV475 Mastering Object-Oriented An
- Page 254 and 255: 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
Module 6 - Use-Case <strong>Analysis</strong>What Does Multiplicity Mean?What Does Multiplicity Mean?• Multiplicity answers two questions:• Is the association m<strong>and</strong>atory or optional?• What is the minimum <strong>and</strong> maximum number ofinstances that can be linked to one instance?CourseOffering0..* 1Course0..*preRequisites 0..3<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 49• Multiplicity lets you know the lower <strong>and</strong> the upper bound number ofrelationships that a given object can have <strong>with</strong> another object. Many times youdo not know what the maximum number of instances may be, <strong>and</strong> you will usethe “*” to specify that this number is unknown.• The most important question that multiplicity answers: Is the association ism<strong>and</strong>atory? A lower bound number that is greater than zero indicates that therelationship is m<strong>and</strong>atory.• This example indicates that a course object can be related to zero or more courseofferings. You can tell that the relationship is optional because the lower boundnumber is zero. The upper bound number of the relationship is unknown, asindicated by the “*”. If you read the association the other way, you will see that agiven course offering object can be related to only one course. This relationship ism<strong>and</strong>atory <strong>and</strong> indicates that it is not possible for a course offering object to exist<strong>with</strong>out an associated course object.6 - 49