21.08.2013 Views

Software Engineering for Students A Programming Approach

Software Engineering for Students A Programming Approach

Software Engineering for Students A Programming Approach

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.

162 Chapter 12 ■ Design patterns<br />

Some people like to distinguish types of patterns:<br />

■ architectural patterns – the highest level structures, applicable to large numbers of<br />

classes<br />

■ design patterns – patterns applicable at the level of small groups of classes<br />

■ coding patterns – applicable to detailed algorithms within methods<br />

■ anti-patterns – the opposites of patterns.<br />

You know you understand patterns when you can see how to use two or more in<br />

your project. Many software systems use two or sometimes more patterns.<br />

Summary<br />

Patterns embody the experience of developers. They document useful architectural<br />

structures (Some patterns also record techniques <strong>for</strong> activities such as testing.) A<br />

pattern has a name, an application domain and a suggestion <strong>for</strong> a solution. Patterns<br />

enable novices to use the knowledge of experts. They provide a body of knowledge<br />

and a language <strong>for</strong> talking about structure. Patterns are documented in catalogs<br />

(see the reading list below) <strong>for</strong> browsing prior to and during architectural software<br />

design.<br />

This chapter explains how to use some useful design patterns (and some antipatterns):<br />

■ Inheritance – extending an existing class<br />

■ Delegation – using other classes to per<strong>for</strong>m useful tasks<br />

■ Singleton – a class with only one instance<br />

■ Factory Method – creating the appropriate class at run time<br />

■ Façade – creating a front end to make using a collection of classes easier<br />

■ Immutable – an object that does not change<br />

■ Model-View-Controller – separating input, output and logic<br />

■ Mediator – encapsulating the interaction between classes<br />

■ Pipe and Filter – components that process a serial stream of data, passing it<br />

from one to another<br />

■ Proxy – a component that accepts requests on behalf of other components<br />

■ Layers – separating large scale architecture into levels<br />

■ Blob – an anti-pattern, a single complex class.

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

Saved successfully!

Ooh no, something went wrong!