Re: Clean Object Class Design -- Circle/Ellipse
having a master of science in theoretical mathematics, perhaps some would
agree that i may provide an informed perspective on the topics at hand.
first, wrt two dimensional geometries, there are really only two kinds:
closed curves and open curves. any closed curve can be mapped into any
other closed curves by applying some function(s); ie, all closed curves are
isomorphic. similarly, all open curves are isomorphic. it makes no
difference what you choose to label your closed curve... it is just an
alternative representation of any other closed curve. there are well known
proofs of these statements.
second, wrt classes, whether or not one subclasses one from the other just
depends. it may or may not be useful. this is a design decision to be made
by a "hopefully" informed application architect or developer. it might
even be more useful to begin with the actual mathematical definitions, ie,
two dimensional entities (2De). then sublcass into 2De-open and 2De-closed.
open curves has well defined functions, such as slope, intercept, rate of
change (d f(x) = dx), etc. similarly closed curves have common properties
such as perimeter, area, centers, etc... as for the practicality of doing
this, again, it just depends... are you writing a mathematical application
or just trying to simplify geometires commonly used... rectangle, square,
circle, elipse, trapezoid, rhombus, etc... [of course, these could be
derived from parallelograms].
unless there is a clear understanding of the scope and nature of the
project, one has a hard time making a determination as to which approach is
optimal. one even must take into account the performance characteristics of
the programming language and platforms. for example, while Ada is very
flexible wrt generic classes and generic instantations as well as
subclassing, etc, it is a resource hog, as is java. the dependencies in Ada
results in minor chagnes in the original base class or significantly distant
ancestors a major effort to recomplie (the entire application).
just my $0.02g
Received on Tue Aug 21 2001 - 01:10:33 CEST
Original text of this message