![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
The modularity principle: Generally, you should divide your programs into units that you can develop and maintain independently. Programs so divided are said to be modular.
One way to achieve modularity is to define your classes such that they reflect naturally occurring categories, exploiting the tendency of human language to divide the world into coherent, relatively independent concepts.
Thus, you define a Vegetable
class to reflect the category
identified by the word vegetable; Similarly, you define the
Diary
class to reflect the category identified by the phrase
dairy product.