1 UML Notation Conventions

advertisement
UML Modeling Methodology
1 UML (Unified Modeling Language) Notation Conventions
1.1 Classes
Classes are modeled in the standard UML notation, as follows:
ClassName
attributes : Type
operations()
1.2 Inheritance
Inheritance between classes will be modeled in standard UML notation where it is applicable.
Inheritance (or “Generalization”, as it is known in the UML) will be shown as follows:
In this example, Email, Telephone, and Telefax are all “kinds of” CommunicationChannels.
Because CommunicationNumber is a protected attribute of CommunicationChannel, all three
subclasses will inherit their own CommunicationNumber.
The Liskov Substitution Principle (LSP) states that an instance of a subclass must be able to be
used wherever an instance of a superclass is used without breaking semantic rules. Remember:
Subclasses get all the attributes, relationships, and operations from their superclasses.
Page 1 of 9
UML Modeling Methodology
1.3 Relationships
1.3.1 Associations
Associations will be represented in standard UML notation, with role names and multiplicities
specified as follows:
Quantity
value : int
+requestedQuantity
1
OrderLineItem
lineItemNumber : int
1
In this case, the association is unidirectional. OrderLineItem can “see” or initiate
communication with Quantity, but not the other way around.
1.3.2 Aggregation
Aggregation will be represented in standard UML notation, with role names and multiplicities
Party
1
NameAndAddress
name : String
<<optional>> street : String
city : String
+theNameAndAddress
<<optional>> state : String
1 <<optional>> postalCode : String
countryISOCode : String
languageOfTheParty : String
specified as follows:
In this case, the aggregation indicates NameAndAddress is “a part of” the Party.
Page 2 of 9
UML Modeling Methodology
1.3.3 Dependencies
A dotted arrow will illustrate dependencies:
TradeItemMeasures
netContent : Measurement
grossWeight : Measurement
packingWeight : Measurement
<<optional>> degreeOfOriginalWort : String
<<optional>> depth : Measurement
<<optional>> diameter : Measurement
<<optional>> drainedWeight : Measurement
<<optional>> fatContent : Measurement
<<optional>> fatContentBasisOfMeasurement : Measurement
<<optional>> height : Measurement
<<optional>> numberOfCompleteLayersPerTradeItem : int
<<optional>> numberOfLayersPerPallet : int
<<optional>> numberOfTradeItemsContainedInACompleteLayer : int
<<optional>> numberOfTradeItemsPerPallet : int
<<optional>> numberOfTradeItemsPerPalletLayer : int
<<optional>> pegHorizontal : Measurement
<<optional>> pegVertical : Measurement
<<optional>> percentageOfAlcoholByVolume : float
<<optional>> width : Measurement
Measurement
unitOfMeasure : String
value : float
The above diagram shows that TradeItemMeasures depends on Measurement. Many of the
attributes in TradeItemMeasures rely directly on Measurement to describe their type.
1.4 Multiplicity
Multiplicity is shown in the standard UML notation. Without one of the following
multiplicities, a relationship is not considered completely defined.
Notation
1
1..n
0..n
0..1
n
Meaning
Exactly one (mandatory)
One or more (mandatory)
Zero or more (optional)
Zero or one (optional)
Exact amount greater than one
(mandatory) * not currently supported
Page 3 of 9
UML Modeling Methodology
1.5 Attributes
Each attribute will have a “EAN.UCC tab” that will describe:
0
1
2
3
Min – Minimum value for the attribute.
Max – Maximum value for the attribute.
Mask – The format of the attribute (i.e. The mask for a SSN would be: 999 – 99 –
9999)
Values List – Possible values for the attribute if the attribute is an enumerated type (i.e.
The Value for marriageStatus would be Single, Married, Divorced, or Widowed).
NOTE: If the attribute has a fixed value, the Minimum and Maximum values should be set to
the same number. For example, for the attribute freezingPointOfWater, the Minimum and
Maximum would both be set to 0.
The “Mask” field of the EAN.UCC tab will be used to describe the formatting of an attribute.
For example, if the first 3 characters of a serial number are letters and the last 5 are digits, the
EAN.UCC tab would be filled out as follows:
Page 4 of 9
UML Modeling Methodology
1.6 Naming Conventions
Consistent naming conventions will be used throughout the model. The basic rules shall be as
follows:
0
1
2
3
Class names will be displayed as InitCaps.
Class names will also be singular.
Names of Collections will be plural.
Attribute names/Association role names will be displayed as InitCaps except for the
first letter, which will be lowercase.
For example:
Contact
personOrDepartmentName : TextDescription
<<enumeration value>> contactType : String
+theCommunicationChannels
1
0..n
Page 5 of 9
CommunicationChannel
<<enumeration value>> channelType : String
communicationChannel : String
UML Modeling Methodology
1.7 Notes
Notes are used to elaborate when the UML notation does not describe sufficiently. Notes are an
unstructured means of expression and should be replaced with structured notation wherever
possible.
In this example, the requirement to have at least one LogisticUnit or one ItemContainment is
captured in a note.
1.8 Role Names
OrderPartyIdentification
<<enumeration value>> role : String
+seller
1
1
+buyer
1
+shipTo
1
1
Order
1
1.9 Role names note the purpose or capacity of a class in
association with another class. The role name is placed near the
class it modifies. Role names are used to clarify the relationship
between two classes, and should be used as a matter of
course.Types
Page 6 of 9
UML Modeling Methodology
Data types shall be used for all attributes. These types describe the format used when the
attribute is realized. Types shall conform to standard UML types or special types defined for
the EAN.UCC System.
1.9.1 Standard UML Types
Boolean: an enumerated type with the two values True or False.
Float: a number represented by a mantissa and an exponent according to a given base (the sum
of an integer and decimal).
Integer: a positive and negative whole number.
Single: a single character.
String: a sequence of characters.
1.9.2 Special Types
Date:
The class Date.
Measurement: The class Measurement.
TextDescription: Text up to n characters in length.
Quantity: The class Quantity.
GlobalTradeItemNumber: Complying with the GTIN data format (class).
GlobalLocationNumber: Complying with the GLN data format (class).
SSCC: Complying with the SSCC data format (class).
1.10 Stereotypes
A shorthand syntax for extensions to the metamodel, stereotypes indicate the use a specific
extension. Stereotype names are always shown between guillamets (<< >>).
<<enumerationvalue>>Applies to a class. The class is a constrained list of values from which
one value is used to realize an attribute.
<<extends>> Applies to the relationship between two use-case realizations. An extend
relationship means that a use-case realization extends the behavior described in another usecase realization.
<<includes>> Applies to the relationship between two use-case realizations. An include
relationship means that a use-case realization includes the behavior described in another usecase realization.
Page 7 of 9
UML Modeling Methodology
<<optional>> Applies to an attribute. Indicates the attribute is optional within the class.
Equates to a cardinality if 0..1 at the attribute level.
<<realize>> Applies to relationship between use-case realization and use-case.
The dependency between the use-case realization and the realized use-case is qualified with the
«realize» stereotype.
<<UCR>> Applies to a UsecaseRealization package, which describes how each use-case,
defined in the Requirements Analysis activity, translates into the solution.
1.11 Enumerated Values
This convention is for an attribute instantiated from a constrained set of values. The approach
will accommodate any kind of list, including natural language lists. Literally enumerated
values or code lists are not necessary, but can also be accommodated.
A class containing a constrained set of values shall be identified with the stereotype
<<enumeration value>>. Only one of these values, shown as attributes, would be used to
Contact
personOrDepartmentName :
TextDescription
1
+theCommunicationChannel
CommunicationChannel
s
communicationChannel : String
0..n
1
1
1
1
<<enumeration value>>
ContactType
accountingContact
purchasingContact
salesAdministration
<<enumeration value>>
ChannelType
email
telephone
telefax
website
instantiate the class. For example:
The values are provided as attributes. No additional typing is needed, as the attributes shown
are the values.
1.12 Root – (UML assign: XML impact)
The root element in a diagram will be shown in Red. In this diagram, Order is the Root
Element.
Page 8 of 9
UML Modeling Methodology
Page 9 of 9
Download