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

Create successful ePaper yourself

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

As the framework takes shape you should be continually attempting to refine it by adding more<br />

default behavior, more hooks into it as well as additional ways for users to interact with it. You will also<br />

need to produce concrete inst<strong>an</strong>tiations of the framework to test its functionality <strong><strong>an</strong>d</strong> to customizability.<br />

These example inst<strong>an</strong>tiations should be included with the framework as part of the deliver ed product<br />

(whether it is delivered internally or externally to your org<strong>an</strong>ization).<br />

The whole development process is extremely iterative but is by necessity subject to the strictest of<br />

software engineering practice. In addition suitable documentation of the framework is essential (<strong><strong>an</strong>d</strong> this<br />

is where design patterns come into their own) from design, implementation <strong><strong>an</strong>d</strong> user perspectives.<br />

Finally, some useful general comments about framework development include:<br />

• Develop frameworks by examining existing applications.<br />

• Develop small focused frameworks (breaking down larger frameworks when the opportunity to<br />

do so is identified).<br />

• Build frameworks using <strong>an</strong> iterative process prototyping how the frameworks will be used all the<br />

time.<br />

• Always look out for additional fun ctionality for the framework. For such functionality,<br />

determine whether it should be a default behavior of the framework or whether a hook should be<br />

provided to allow a user to implement it.<br />

• Good documentation is essential <strong><strong>an</strong>d</strong> should include sample inst<strong>an</strong>t iations of the framework,<br />

descriptions of the framework architecture, descriptions of the framework <strong><strong>an</strong>d</strong> its intent,<br />

guidelines on using the framework <strong><strong>an</strong>d</strong> cookbook examples for particular operations.<br />

21.2.3 What is a design pattern?<br />

Design patterns capture expertise in building object oriented software [Gamma et al 1993; Johnson<br />

1992; Beck <strong><strong>an</strong>d</strong> Johnson 1994]. A design pattern describes a solution to a recurring design problem. It<br />

also contains information on the applicabili ty of a pattern, the trade offs which must be made <strong><strong>an</strong>d</strong> <strong>an</strong>y<br />

consequences of the solution. Books are now appearing which present such design patterns for a r<strong>an</strong>ge<br />

of applications. For example, [Gamma et al, 1995] is a widely cited book which presents a cat alog of<br />

23 design patterns. Design patterns are extremely useful for both novice <strong><strong>an</strong>d</strong> experienced object<br />

oriented designers. This is because they encapsulate extensive design knowledge <strong><strong>an</strong>d</strong> proven design<br />

solutions with guid<strong>an</strong>ce on how to use them. Reusing common patterns opens up <strong>an</strong> additional level of<br />

design reuse, where the implementations vary, but the micro -architectures represented by the patterns<br />

still apply.<br />

There are potentially very m<strong>an</strong>y design patterns available to a designer. A number of these patterns<br />

may superficially appear to suit their requirements, even if the design patterns are available on -line (via<br />

some hyper text style browser) it is still necessary for the designer to search through them m<strong>an</strong>ually,<br />

attempting to identify the design which best matches their requirements.<br />

In addition, once they have found the design which they feel best matches their needs, they must<br />

then consider how to apply it to their application. This is because a design pattern describes a solution<br />

to a particular design problem. This solution may include multiple trade offs which are contradictory<br />

<strong><strong>an</strong>d</strong> which the designer must choose between, although some aspects of the system structure c<strong>an</strong> be<br />

varied independently (although some attempts have been made to automate this process for example<br />

[Budinsky et al 1996]).<br />

Patterns seem to be exceptionally well suited for documenting frameworks. They certainly provide<br />

guid<strong>an</strong>ce on how to use a framework, the purpose of the framework, they c<strong>an</strong> also include concrete<br />

examples <strong><strong>an</strong>d</strong> c<strong>an</strong> be used to document the design of the framework.<br />

21.2.4 Pattern templates<br />

The pattern template used in [Gamma et al , 1995] provides a st<strong><strong>an</strong>d</strong>ard structure for the information<br />

which comprises a design pattern. This makes it easier to comprehend a design pattern as well as<br />

providing a concrete structure for those defining new patterns. Gamma’s book [Gamma et al , 1995]<br />

provides a detailed description of the template; only a summary of it is presented in Table 21.1.<br />

Patterns are best suited for teaching how to use a framework, but with care they c<strong>an</strong> meet all three<br />

purposes identified earlier. By describing the design of a framework in terms of patterns, you describe<br />

both the design <strong><strong>an</strong>d</strong> the rationale behind the design. As patterns also show how to use the framework for<br />

173

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

Saved successfully!

Ooh no, something went wrong!