Smalltalk and Object Orientation: an Introduction - Free
Smalltalk and Object Orientation: an Introduction - Free
Smalltalk and Object Orientation: an Introduction - Free
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
car, truck <strong><strong>an</strong>d</strong> bus under a superclass vehicle makes sense. However, adding the class student just<br />
because they all share the attribute registrationNumber does not make sense!<br />
Identifying specializations c<strong>an</strong> be more difficult, however if you find a class playing a number of<br />
specific roles then specialization may be appropriate. Note that you should be wary of specialization as<br />
you do not w<strong>an</strong>t to over specialize the classes in your object model. This is because you may actually be<br />
talking about separate inst<strong>an</strong>ces of the same class, rather th<strong>an</strong> subclasses.<br />
19.3.2.6 Testing access paths<br />
This step involves checking that paths in the model make sense, are sufficient <strong><strong>an</strong>d</strong> are necessary. O MT<br />
suggest that you trace access paths through the object model to see if they yield sensible results. The<br />
sorts of issues you might wish to consider are:<br />
• Where a unique value is expected, is there a path yielding a unique result?<br />
• For multiplicity “m<strong>an</strong>y” is there a way to pick out a unique value when needed?<br />
• Are there <strong>an</strong>y useful (domain specific/application specific) questions which c<strong>an</strong>’t be <strong>an</strong>swered?<br />
19.3.2.7 Iterate <strong><strong>an</strong>d</strong> refine the model<br />
There are two things you will come to learn about object design, firstly it i s still more of <strong>an</strong> art th<strong>an</strong> a<br />
science <strong><strong>an</strong>d</strong> secondly (unless the problem is trivial) the first version of the object model will probably<br />
not be correct (or complete). <strong>Object</strong> oriented design is far more iterative in nature th<strong>an</strong> some other<br />
design methods <strong><strong>an</strong>d</strong> it therefore acknowledges that you will need to iterate over the whole of the above<br />
process a number of times to get a reasonable object model. Indeed some ch<strong>an</strong>ges will be initiated by<br />
the development of the dynamic model <strong><strong>an</strong>d</strong> the functional model which you have not even considered<br />
yet (for example we have not attempted to identify <strong>an</strong>y operations for the object model at this point).<br />
At this point some of the questions you c<strong>an</strong> ask yourself about the object model are:<br />
• Are there <strong>an</strong>y missing objects (does one class play two roles)?<br />
• Are there <strong>an</strong>y unnecessary classes (such a class might possess no attributes)?<br />
• Are there <strong>an</strong>y missing associations (such as a missing access path for some operation)?<br />
• Are there <strong>an</strong>y unnecessary associations (such as those that are not used by <strong>an</strong>ything)?<br />
• Are all attributes in the correct class?<br />
• Are all associations in the correct place?<br />
Cross referencing the object model with the use case model may help <strong>an</strong>swer some of the above<br />
questions.<br />
19.3.2.8 Group classes into modules/packages<br />
The final step associated directly with the object model is to group classes into packages. Packages<br />
should be identified by looking for classes which work together. Do not base the packages purely on<br />
system functionality as this is likely to ch<strong>an</strong>ge <strong><strong>an</strong>d</strong> will result in inappropriate packaging. OMT suggests<br />
that you ensure that a package c<strong>an</strong> be fitted onto a single drawing surface (be that paper or the screen)<br />
as this aids comprehensibility. In addition, packages c<strong>an</strong> be hierarchical <strong><strong>an</strong>d</strong> c<strong>an</strong> be a very useful way of<br />
partitioning the design of the system amongst a number of designers.<br />
161