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.

192<br />

class Md Mi Ad Ai<br />

A x(),y() none a none<br />

B w(),z(),y() A::x() b,bb A::a<br />

C v() B::w(),z(),y c B::bb<br />

12.3.3 COUPLING FACTOR<br />

CHAPTER 12 Object-Oriented Metrics<br />

A::x()<br />

MIF ¼ 5=11 AIF ¼ 2=6<br />

The coupling factor (CF) measures the coupling between classes excluding coupling<br />

due to inheritance.<br />

Let is_client(c i,c jÞ¼1 if class i has a relation with class j; otherwise, it is zero.<br />

The relation might be that class i calls a method in class j or has a reference to class<br />

j or to an attribute in class j. This relationship cannot be inheritance.<br />

CF ¼<br />

XTC XTC i¼1<br />

j¼1<br />

is_clientðc i; c jÞ<br />

TC 2 TC<br />

EXAMPLE 12.4<br />

Calculate the coupling factor on the object model shown in Fig. 12-3 for the bedand-breakfast<br />

problem (Problem 11.4). Onlyassume a relationship if it is required<br />

bythe associations shown on the diagram.<br />

1<br />

1<br />

B&B<br />

1<br />

1<br />

1..n<br />

1..n<br />

0..n<br />

0..n<br />

calendar bedroom customer<br />

transaction<br />

1<br />

0..n<br />

1<br />

0..n 0..n<br />

reservation<br />

1<br />

Fig. 12-3<br />

payment expense

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

Saved successfully!

Ooh no, something went wrong!