The subclasses look small because every
last drop of commonality has been squeezed out of them into the superclass. None of
them will be the same, because in that case the modeler would have reused the
corresponding model element rather than creating a duplicate. Finally, the amount of
common content in groups of subclasses would be so small that the weight of an extra
class would normally not be justi?¬?ed.
The last two points need a little clari?¬?cation: at any given state of the models, there
may well actually exist complete duplicates or sets of classes with common elements.
However, the duplication will be purely coincidental, and could change at any time.
The duplication is more like that found when two Person objects have the same height
and weight: it does not mean we need to separate that ???commonality??? into a new
HeightAndWeight class, with both Person objects pointing to the same instance. Of
course, there will be cases where you missed something in the domain analysis, and
you really should make the granularity of reuse ?¬?ner in the models. In our Person
analogy, that might correspond to noticing that groups of people tended to share the
same surname and address ?¬?elds, leading you to posit a Family class.
Finally, there may be cases where the singleton classes only differ in name and the
values they give to static variables.
Pages:
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606