22.11.2012 Views

Schaum's Outline Series

Schaum's Outline Series

Schaum's Outline Series

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.

174<br />

CHAPTER 11 Object-Oriented Development<br />

sometimes have special attributes. This is usually an effective approach to finding<br />

inheritance.<br />

The opposite approach is also sometimes useful. It is a bottom-up approach,<br />

which is to group all similar items and look for the commonality. The intersection<br />

of all the similar items will become the base class.<br />

EXAMPLE 11.6<br />

Identifythe possible inheritance in the grocerystore (Example 11.4).<br />

A top-down approach would help to realize that the meat department and the<br />

produce department have special processing of the items. This would lead to a<br />

base class of items and derived classes of meat and produce. An expert in the<br />

domain of grocerystores could help to identifyall the other derived classes that<br />

can occur in a grocerystore.<br />

Additionally, a bottom-up approach would find the commonality among the<br />

objects losses, discount, return, and purchase. This suggests that those<br />

objects can be derived from an object transaction. See Fig. 11-5.<br />

suppliers<br />

shipment<br />

item<br />

quantity<br />

produce meat<br />

grocery<br />

store<br />

name<br />

address<br />

inventory<br />

11.2.3 IDENTIFYING REUSE<br />

transaction<br />

customer<br />

losses discount return purchase<br />

Fig. 11-5<br />

Reuse is one of the promises of object-oriented software. However, reuse rarely<br />

happens by itself. The first step in identifying reuse is a task called domain analysis.<br />

Domain analysis is the process of reviewing the problem domain to determining<br />

what objects and functions are common to all activities. Without good domain<br />

knowledge, it will be hard to identify what commonalities exist between all similar<br />

systems in that domain. For reuse to be effective, the parts that will be useful in<br />

multiple solutions in that domain must be identified. This means understanding<br />

the potential commonalities.<br />

Approaches to reuse can be top-down or bottom-up. Bottom-up approaches<br />

look for low- or middle-level classes that will be common in most solutions in that

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

Saved successfully!

Ooh no, something went wrong!