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 ...

crnarupa.singidunum.ac.rs
from crnarupa.singidunum.ac.rs More from this publisher
12.07.2015 Views

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

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

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!