[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

DiscreteIntervals and DiscreteIntervalUnions



Date: Mon, 13 Nov 89 22:30:54 PST
   From: heh (Hugh Hoover)

     I really really really really really want these 2 region classes to have
   a mostly common protocol that is slightly larger than DiscreteRegion.
     We can either have (another) common superclass for these, or make one
   a subclass of the other.  I think I prefer the latter, and suggest that
   DiscreteIntervalUnion be a subclass of DiscreteInterval.  

I much prefer adding an abstract superclass like
BoundedDiscreteRegion. The two classes have completely distinct
instance variables and method definitions, so subclassing one to the
other is not a good idea. What if you forget a definition in a subclass
and it gets caught by the super and does something unknown to instance
variables that the subclass ignores? With a common superclass you can
use self subclassResponsibility to catch errors like that. This is a
better fit conceptually as well, since they share protocol but not
implementation.
	--ravi