CS FundamentalsVery hardProduct-company design interview

A package has 6 classes outside it depending on it (afferent coupling Ca = 6) and depends on 2 outside classes (efferent coupling Ce = 2). Half its classes are abstract. Using Robert Martin's metrics I = Ce/(Ca + Ce) and distance D = |A + I - 1|, what are its instability and distance from the main sequence?

  1. A. I = 0.75, D = 0.25
  2. B. I = 0.25, D = 0.75
  3. C. I = 0.25, D = 0.25
  4. D. I = 0.75, D = 0.75

Correct answer: C. I = 0.25, D = 0.25

I = 2/(6 + 2) = 0.25 (a stable package) and D = |0.5 + 0.25 - 1| = 0.25. Swapping Ca and Ce gives I = 0.75; forgetting the '- 1' gives 0.75 for D.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic