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.

194<br />

Review Questions<br />

1. Why are McCabe’s cyclomatic number and Halstead’s software science not readily<br />

applicable to object-oriented software?<br />

2. What abstractions are available in object-oriented design to be used as the basis of<br />

object-oriented metrics?<br />

3. When should a metric for a whole system be different than either the sum or the<br />

average of metrics calculated for each class?<br />

4. Is a high LCOM good or bad?<br />

5. Some people have suggested that, in LCOM, just using the difference between the size<br />

of P and Q. That is, the use of the maximum of zero and this difference is not effective.<br />

What would be the effect of this change?<br />

Problems<br />

1. Calculate the Chidamber metrics for the following code that maintains an array of<br />

people/students:<br />

class person{<br />

char* name;<br />

char* ssn;<br />

public:<br />

person(){name = new char[NAMELENGTH]; ssn = new<br />

char[SSNLENGTH];}<br />

~person(){delete name; delete ssn;}<br />

void addName(char* newname){strcpy(name, newname);}<br />

void addSsn(char* newssn){strcpy(ssn, newssn);}<br />

char* getName(){return name;}<br />

void virtual display(){cout

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

Saved successfully!

Ooh no, something went wrong!