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 <strong>Patterns</strong> 2O7<br />

Remember, I am not concerned about the design of the expert sys- Expanding the<br />

tem. While interesting (and, in many ways more challenging), that design design<br />

had already been worked out. My focus is on the design of the Mode l. I know that<br />

the Model consists of Features, as shown in Figure 12-5. l<br />

Figure 12-5 The Model design.<br />

Now, I am ready for the Bridge pattern. It is apparent that I have<br />

multiple Features (the abstraction) with multiple CAD/CAM systems<br />

(the implementations). These are the objects that set the context<br />

for the Bridge pattern.<br />

The Bridge pattern relates the Features to the different CAD/CAM<br />

system implementations. The Feature class is the Abstraction in<br />

the Bridge pattern while the V1 and V2 systems are the Implementations.<br />

But what about the Model? Is there a Bridge pattern<br />

present here as well? Not really. I can build the Model using inheritance<br />

because the only thing about the Model that varies is the<br />

implementation that is being used. In this case, I could make derivations<br />

of the Model for each CAD/CAM system as in Figure 12-6.<br />

If I tried using a Bridge pattern for the Model, I'd get the design<br />

shown in Figure 12-7.<br />

1. The differences between V1Model and V2Model present little difficulty. Therefore,<br />

I will only discuss Model in general.<br />

Ready for the Bridge<br />

How do we handle<br />

the Model?

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

Saved successfully!

Ooh no, something went wrong!