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.

70 Chapter 6 ■ Modularity<br />

There are there<strong>for</strong>e three requirements <strong>for</strong> a reuseable component:<br />

■ it provides a useful service<br />

■ it per<strong>for</strong>ms a single function<br />

■ it has the minimum of connections (ideally no connections) to other components.<br />

6.3 ● Component types<br />

Components can be classified according to their roles:<br />

■ computation-only<br />

■ memory<br />

■ manager<br />

■ controller<br />

■ link.<br />

A computation-only component retains no data between subsequent uses. Examples<br />

are a math method or a filter in a Unix filter and pipe scheme.<br />

A memory component maintains a collection of persistent data, such as a database<br />

or a file system. (Persistent data is data that exists beyond the life of a particular program<br />

or component and is normally stored on a backing store medium, such as disk.)<br />

A manager component is an abstract data type, maintaining data and the operations<br />

that can be used on it. The classical examples are a stack or a queue.<br />

A controller component controls when other components are activated or how they<br />

interact.<br />

A link component transfers in<strong>for</strong>mation between other components. Examples are a<br />

user interface (which transfers in<strong>for</strong>mation between the user of a system and one or<br />

more components) and network software.<br />

This is a crude and general classification, but it does provide a language <strong>for</strong> talking<br />

about components.<br />

6.4 ● Component size and complexity<br />

How big should a software component be? Consider any piece of software. It can<br />

always be constructed in two radically different ways – once with small components and<br />

again with large components. As an illustration, Figure 6.1 shows two alternative structures<br />

<strong>for</strong> the same software. One consists of many small components; the other a few<br />

large components.<br />

If the components are large, there will only be a few of them, and there<strong>for</strong>e there<br />

will tend to be only a few connections between them. We have a structure which is a<br />

network with few branches and a few very big leaves. The complexity of the interconnections<br />

is minimal, but the complexity of each component is high.

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

Saved successfully!

Ooh no, something went wrong!