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.

CHAPTER 9 Software Design 141<br />

Answers to Review Questions<br />

1. Given the following design, indicate for the following ideas of coupling, cohesion, and<br />

abstraction whether it is desirable to have a high or low value and how this design<br />

exemplifies the term.<br />

Class college<br />

student* stulist[MAX]<br />

course* courselist[MAX]<br />

public:<br />

addStudent(char* studentname)<br />

addStudentToCourse(char* studentname, char*<br />

coursename)<br />

void displayStudent(char* studentname)<br />

void displayStudentsInCourse(char* coursename)<br />

Class course<br />

student* classroll[MAX]<br />

public:<br />

void displayStudents()<br />

Class student<br />

char* name<br />

public:<br />

void displayname()<br />

Coupling—Low coupling is desirable, and this design has low coupling, since the<br />

college class has no knowledge of the internals of the other classes and the other<br />

classes do not need to know about college.<br />

Cohesion—High cohesion is desirable, and this has high cohesion, since each class just<br />

deals with its own attributes.<br />

Abstraction—The design shows good abstraction. For example, the display method in<br />

college does not include any details about lower-level display methods.<br />

2. Why does Gunter restrict the terms/events that can be used in a specification? What is<br />

the difference between a user’s requirements and a specification?<br />

Gunter says that a user’s requirements must be specified in terms/events that are<br />

known to the user and may include terms/events hidden to the machine, while a<br />

specification is designed to be the basis of the implementation and must be specified<br />

only in terms that are visible both to the machine and the world.<br />

3. The proposed system is a face recognition based on image processing. The system will<br />

have a camera and is intended to prevent nonemployees from entering the company’s<br />

secret facilities by controlling the lock on the door. When a person tries to turn the<br />

door handle, the system takes an image and compares it with a set of images of current<br />

employees.<br />

Classify each of the following events as to whether the events are in the environment<br />

or in the system and whether the events are hidden or visible:

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

Saved successfully!

Ooh no, something went wrong!