23.07.2012 Views

Design Patterns Explained

Design Patterns Explained

Design Patterns Explained

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.

Chapter 12 • Solving the CAD/CAM Problem with Pattern* 215<br />

In the original solution, I had a model that contains Features.<br />

Features are either slot features, hole features, cutout features,<br />

irregular features, or special features. Slot features are either V1<br />

slots or V2 slots. V1 slots use the V1 system while the V2 slots use<br />

the OOGSlot. Hole features are either V1 hole features or V2 hole<br />

features. V1 hole features use the V1 system while the V2 hole features<br />

use the OOGHole. Getting tired of this already, aren't you?<br />

Now read the latest solution. I have a model that contains Features.<br />

Features are either slot features, hole features, cutout features,<br />

irregular features, or special features. All features contain an implementation<br />

which is either a V1 implementation or a V2 implementation.<br />

V1 implementations use a V1 Facade to access the V1 system<br />

while V2 implementations adapt an OOGFeature. That's it. It<br />

sounds much better than just a portion of the other solution.<br />

Summary<br />

In this chapter, I showed how the standard way of doing designs<br />

can often lock us into systems that are hard to maintain. Often, it<br />

can be difficult to see the forest for the trees because I become<br />

overly focused on the details of the system— the classes.<br />

Christopher Alexander gives us a better way. By using patterns in<br />

the problem domain, I can look at the problem in a different way. I<br />

start with the big picture and add distinctions as I go. Each pattern<br />

gives me more information than what I had before I used it.<br />

By selecting the pattern that creates the biggest picture— the context<br />

for the system— and then inserting the next significant pattern,<br />

I developed an application architecture that I could not have seen by<br />

looking at the classes alone. Thus, I begin to learn to design by<br />

context instead of by putting together pieces that were identified<br />

locally.<br />

In this chapter

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

Saved successfully!

Ooh no, something went wrong!