Smalltalk and Object Orientation: an Introduction - Free
Smalltalk and Object Orientation: an Introduction - Free
Smalltalk and Object Orientation: an Introduction - Free
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
20.3.2.3 Design optimization<br />
The <strong>an</strong>alysis model was only intended to describe the application <strong><strong>an</strong>d</strong> its requirements <strong><strong>an</strong>d</strong> did not<br />
attempt to take into account efficient information access or processing. These issues need to be<br />
considered by the designer at this point. In particular they should consider:<br />
• adding redund<strong>an</strong>t associations to minimize access cost <strong><strong>an</strong>d</strong> maximize convenience,<br />
• rearr<strong>an</strong>ging the computation for greater efficiency,<br />
• saving derived attributes to avoid recomputation of complicated expressions.<br />
20.3.2.4 Implementation of control<br />
During the system design, <strong>an</strong> approach for h<strong><strong>an</strong>d</strong>ling the internal control of the system must have been<br />
identified. That approach is fleshed out here. This includes determining how the selected approach c<strong>an</strong><br />
be implemented <strong><strong>an</strong>d</strong> identifying <strong>an</strong>y constraints this choice imposes on the design.<br />
20.3.2.5 Adjust class structure<br />
As the design progresses the class hierarchy is likely to ch<strong>an</strong>ge, evolve <strong><strong>an</strong>d</strong> become refined. It is quite<br />
common to produce a design <strong><strong>an</strong>d</strong> then to rearr<strong>an</strong>ge it in light of commonalities which were hidden at <strong>an</strong><br />
earlier stage. The designer should:<br />
• rearr<strong>an</strong>ge <strong><strong>an</strong>d</strong> adjust classes <strong><strong>an</strong>d</strong> operations to increase inherit<strong>an</strong>ce,<br />
• abstract common behavior out of groups of classes,<br />
• use delegation to share behavior when inherit<strong>an</strong>ce is sem<strong>an</strong>tically invalid.<br />
20.3.2.6 Design associations<br />
Associations are <strong>an</strong> import<strong>an</strong>t aspect of the <strong>an</strong>alysis object model. However, they are conceptual<br />
relationships <strong><strong>an</strong>d</strong> not implementation oriented relationships. The designer needs to consider how the<br />
associations c<strong>an</strong> be implemented in a given l<strong>an</strong>guage. The choices made for representing associations<br />
may be made globally for the whole system, locally to a package or on <strong>an</strong> association by association<br />
basis. The criteria u sed for determining how associations should be represented in the design are based<br />
on how are they traversed. If they are traversed only in one direction then a pointer representation may<br />
be sufficient. However, if they are bi -directional then <strong>an</strong> intermedi ate object may best represent the<br />
association.<br />
20.3.2.7 Determine object representation<br />
In most situations it is relatively straight forward to identify how to represent <strong>an</strong> object. However in<br />
some cases consideration needs to be given to decide whether to use a system primitive or <strong>an</strong> object. For<br />
example, in Java there are basic types int <strong><strong>an</strong>d</strong> char <strong><strong>an</strong>d</strong> there are also classes Integer <strong><strong>an</strong>d</strong><br />
Character.<br />
20.3.2.8 Package classes<br />
The system will have been decomposed into logical packages in the system design. However, dif ferent<br />
l<strong>an</strong>guages provide different facilities for physically packaging a system. VisualWorks provides class<br />
categories which c<strong>an</strong> be used in a similar m<strong>an</strong>ner to packages but they do not provide <strong>an</strong>y information<br />
hiding etc.<br />
20.4 Implementation phase<br />
OMT states tha t implementation is “<strong>an</strong> extension of the design process” <strong><strong>an</strong>d</strong> that “writing code should<br />
be straightforward, almost mech<strong>an</strong>ical, because all the difficult decisions should already have been<br />
169