29.11.2014 Views

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

19.3.2.2 Prepare a data dictionary<br />

A data dictionary provides a definition for each of the terms / words being used in the evolving <strong>an</strong>alysis<br />

models. Each entry precisely describes each objec t class, its scope, <strong>an</strong>y assumptions or restrictions on<br />

its use <strong><strong>an</strong>d</strong> its attributes <strong><strong>an</strong>d</strong> operations (once they are known).<br />

19.3.2.3 Identify associations between objects<br />

The next step is to identify <strong>an</strong>y (<strong><strong>an</strong>d</strong> all) associations between two or more classes. This is done by<br />

looking for references between two classes. OMT suggests that a good place to look for these<br />

relationships is to examine the problem description for verbs or verb phrases between known objects. In<br />

particular it identifies the following types of relationships:<br />

• physical location (next to, part of, contained in)<br />

• directed actions (drives)<br />

• communication (talks to)<br />

• ownership (has, part of)<br />

• satisfaction of some condition (works for, married to, m<strong>an</strong>ages)<br />

Again OMT exhorts you to identify all possible relationships <strong><strong>an</strong>d</strong> not to worry at this point about getting<br />

it right.<br />

If you have used a method such as OOA you might already have some knowledge about the<br />

relationships between the classes in the domain, if not then considering which classes are likely to need<br />

to work with which other classes (i.e. the accounts clerk may need to work with the salaries clerk) is<br />

also a good place to start. This process will be simplified if you have performed a use case <strong>an</strong>alysis.<br />

Once you have a set of c<strong><strong>an</strong>d</strong>idate associations, OMT pr ovides a detailed set of criteria to help in<br />

refining them. The criteria are:<br />

Is the association one which is between eliminated classes ? If one of the classes involved in the<br />

association has been eliminated then the association should be eliminated.<br />

Are <strong>an</strong>y of the associations irrelev<strong>an</strong>t or implementation associations ? Eliminate <strong>an</strong>y associations<br />

that are outside the scope of the application domain (including implementation related associations).<br />

Are <strong>an</strong>y associations tr<strong>an</strong>sient ? An association should be a s tructural property of the applications<br />

domain. For example, interacts with user is a temporary association in a hotel booking system.<br />

Are <strong>an</strong>y of the associations ternary ? Although the OMT notation <strong><strong>an</strong>d</strong> indeed the UML notation<br />

allow ternary associations, the y are not encouraged. Instead you are encouraged to decompose these<br />

associations into binary ones (they are easier to implement, maintain <strong><strong>an</strong>d</strong> underst<strong><strong>an</strong>d</strong>!).<br />

Are <strong>an</strong>y of the associations derivable ? OMT suggests that you should remove <strong>an</strong>y associations<br />

which ca n be derived from other associations. However you should be wary of removing such<br />

associations as they may be critical to underst<strong><strong>an</strong>d</strong>ing the domain relationships. That is, if <strong>an</strong> association<br />

c<strong>an</strong> be replaced by two existing associations, only do so if the sem<strong>an</strong>tic me<strong>an</strong>ing of the two associations<br />

c<strong>an</strong> be combined to provide the same sem<strong>an</strong>tic me<strong>an</strong>ing as the one to be removed. A good example of<br />

this is that a Gr<strong><strong>an</strong>d</strong>parentsOf relationship c<strong>an</strong> be replaced by two ParentOf relationships.<br />

Having removed inappropriate associations, you c<strong>an</strong> now consider the sem<strong>an</strong>tics of the associations<br />

you have left. To do this you should use these criteria:<br />

Are <strong>an</strong>y of the associations misnamed ? That is, do they actually reflect what they represent? Are<br />

they named after their use or the relationship they indicate?<br />

Add role names where appropriate . As described in the last chapter, role names describe the role<br />

that a class plays in the associations from the point of view of the other class.<br />

Are there <strong>an</strong>y qualified associations? That is, are there <strong>an</strong>y associations which require a qualifier to<br />

identify a unique object.<br />

Specify multiplicity on the associations . That is, indicate how may objects are involved in the<br />

association. By default all associations are 1 to 1 associations. Where no multip licity is specified check<br />

that these really are 1 to 1 links.<br />

Are there <strong>an</strong>y missing associations ? Check that all reasonable associations are present. This may<br />

need to be done in consultation with the domain expert.<br />

159

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

Saved successfully!

Ooh no, something went wrong!