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.

Conceptual Model–Attributes 67Design creep: no attributes as foreign keyAttributes should not be used to relate concepts in the conceptual model, but to store some informationabout the objects themselves. The most common violation of this principle is to add a kind of foreign keyattribute, as is typically done in relational database designs, in order to associate two types. For example,in Figure 5.16, the currentPOSTNumber attribute in the Cashier type is undesirable because its purpose isto relate the Cashier to a POST object. The better way to express that a Cashier uses a POST is <strong>with</strong> anassociation, not <strong>with</strong> a foreign key attribute. Once againrelate types <strong>with</strong> an association, not <strong>with</strong> an attribute.WorseCashiernamecurrentPOSTNumbera ‘‘simple’’ attribute, but beingused as a foreign key to relate to anotherobjectBetterCashiername1 Uses1numberPOSTFigure 5.16: Do not use attributes as foreign keysNon-primitive attribute typesThe type of an attribute may be expressed as a non-primitive type in its own right in the conceptual model.For example, in the point-of-sale system, there is a UPC. It is typically viewed as just a number. So shouldit be represented as non-primitive type? We have the following guidelines:Represent what may initially be considered a primitive type as a non-primitive type if:It is composed of separate sections.=– phone number, name of personThere are operations usually associated <strong>with</strong> it, such as parsing or validation.=– social security number, credit card numberIt has other attributes.=– promotional price could have a start and end dateReport 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!