![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
The no-duplication principle: Instance variables and instance methods should be distributed among class definitions so that there is no needless duplication. Otherwise, duplicate copies are bound to become gratuitously different.
For example, in Segment 269, the fCalories
,
cCalories
, and pCalories
instance variables reside in the
Food
class, rather than in the Vegetable
, Diary
,
Meat
, and Grain
classes, making those instance variables more
generally available.