13.07.2015 Views

Object-Oriented Software Development with UML - UNU-IIST ...

Object-Oriented Software Development with UML - UNU-IIST ...

Object-Oriented Software Development with UML - UNU-IIST ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

66 Conceptual Model–AttributesWhat about attributes in code?The restriction that attributes in the conceptual model be only of simple data type does not imply that C++,Java, or Smalltalk attributes (data members, instance variables) must only be simple, primitive data types.Pure data valueMore generally, attributes should be pure data value (or DataTypes in <strong>UML</strong>)–those for which unique identityis not meaningful in the context of our model or system. For example, it is not (usually) meaningful todistinguish between:Separate instances of the Number 5.=Separate instances of the String ‘cat’.=Separate instances of the PhoneNumber that contain the same number.=Separate instances of the address that contain the same address.=However, it is meaningful to distinguish (by identity) between two instances of a Person whose name areboth “Jill Smith” because the two instances can represent separate individuals <strong>with</strong> the same name.So the second guideline for identifying attributes is:An element of a pure data type may be illustrated in an attribute box section of another concept,although it is also acceptable to model it as a distinct concept.Pure data values are also known as value objects.The notion of pure data values is subtle. As a rule of thumb,stick to the basic test of “simple” attribute types: make it an attribute if it is naturally thoughtof as number, string, boolean, or time (and so on); otherwise represent is as a separate concept.We always have the following rule.If in doubt, define something as a separate concept rather than as an attribute.Report No. 259, July 2002<strong>UNU</strong>/<strong>IIST</strong>, P.O. Box 3058, Macau

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

Saved successfully!

Ooh no, something went wrong!