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.

52 Part II • The Limitations of Traditional Object-Oriented <strong>Design</strong><br />

Polymorphism isn 't<br />

needed at all levels<br />

High-level class<br />

diagram<br />

A more detailed look<br />

at the CAD/CAM<br />

systems<br />

Figure 3-5 High-level view of my solution.<br />

In other words, the application can initalize everything so that the<br />

expert system uses the appropriate CAD/CAM system. However,<br />

the expert system has to be able to use either version. Hence, I need<br />

to make V1 and V2 look the same to the expert system.<br />

Although polymorphism is definitely needed at the geometry<br />

extractor level, it will not be needed at the feature level. This is<br />

because the expert system needs to know what type of features it is<br />

dealing with. However, we don't want to make any changes to the<br />

expert system when Version 3 of the CAD/CAM system comes out.<br />

A basic understanding of object-oriented design implies that I<br />

will have a high-level class diagram similar to the one shown in<br />

Figure 3-6.<br />

In other words, the expert system relates to the CAD/CAM systems<br />

through the Model class. The Main class takes care of instantiating<br />

the correct version of the Model (that is, V1Model or V2Model).<br />

Now, I will describe the CAD/CAM systems and how they work.<br />

Unfortunately , the two are very different beasts.

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

Saved successfully!

Ooh no, something went wrong!