22.11.2012 Views

Schaum's Outline Series

Schaum's Outline Series

Schaum's Outline Series

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 12 Object-Oriented Metrics 193<br />

TC ¼ 7<br />

Class is_client classes<br />

B&B calendar, bedroom, customer, transaction<br />

calendar reservation<br />

bedroom reservation<br />

customer reservation<br />

transaction none<br />

payment none<br />

expense none<br />

CF ¼ 7=42<br />

12.3.4 POLYMORPHISM FACTOR<br />

The polymorphism factor (PF) is a measure of the potential for polymorphism.<br />

Let MoðCiÞ be the number of overriding methods in class i.<br />

Let MnðCiÞ be the number of new methods in class i.<br />

Let DCðCiÞ be the number of descendants of class i.<br />

PTC i¼1 PF ¼<br />

MoðCiÞ PTC i¼1½MnðCiÞ DCðCiÞŠ EXAMPLE 12.5<br />

Calculate the polymorphism factor on the Cþþ code from Example 12.3.<br />

Class Mn Mo DC<br />

Ax(),y() none 2<br />

B w(),z() y() 1<br />

C v() none 0<br />

PF ¼ 1=ð2 2 þ 2 1 þ 1 0Þ ¼1=6

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

Saved successfully!

Ooh no, something went wrong!