Newsgroups: comp.lang.c++,comp.object,comp.theory,comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!cam-news-feed3.bbnplanet.com!cam-news-hub1.bbnplanet.com!news.bbnplanet.com!news.maxwell.syr.edu!news.mathworks.com!uunet!in1.uu.net!128.100.1.3!utcsri!info.ecf!doylep
From: doylep@ecf.toronto.edu (Patrick Doyle)
Subject: Re: Opinions on Ellipse-Circle dilemma?
Sender: news@ecf.toronto.edu (News Administrator)
Message-ID: <E5IAHB.FFI@ecf.toronto.edu>
Date: Wed, 12 Feb 1997 20:05:35 GMT
X-Nntp-Posting-Host: spark21.ecf
References: <5d4fmf$7gk@bagan.srce.hr> <E5B2HH.8AH@ecf.toronto.edu> <E5EMwz.74K@undergrad.math.uwaterloo.ca> <32ffb03c.0@news3.paonline.com>
Organization: University of Toronto, Engineering Computing Facility
Lines: 56
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:247472 comp.object:61053 comp.theory:17918 comp.lang.smalltalk:51480

In article <32ffb03c.0@news3.paonline.com>,  <mfinney@lynchburg.net> wrote:
>
>class Ellipse
>   {
>   private:
>      double xAxis;
>      double yAxis;
>   public:
>      virtual bool isValidAxesRatio(double x, double y) const
>         {
>         return true;
>         }
>      void setAxes(double x, double y)
>         {
>         if (not isValidAxesRatio(x, y))
>            throw "Ellipse precondition exception";
>         xAxis = x;
>         yAxis = y;
>         }
>   };
>
>[...]
>
>This solution works because the setAxes() method has a precondition
>which only permits it to be called for valid x and y ratios.  That
>precondition can be separately checked by calling isValidAxesRatio();.

  I'm a little uncomfortable with this solution.  For one thing, it might
take great insight to see that the isValidAxesRatio is necessary.  However,
one can't program without insight, so that's not really a valid concern
on its own.

  Another problem is that the concept of an invalid axes ratio is not a
part of the definition of an ellipse.  I might call the class a "constrained
ellipse" (and maybe have other sorts of constraints as well as axes ratio),
and have the default constraint be "true" (ie. no constraint).  That
seems a little more pleasing to me.

  What I'm trying to say is that when one asks for a definition of "ellipse",
we don't respond with "a figure (blah blah blah) possibly with constraints
on the ratio of its axes" do we?  However, if asked for the definition of
a constrained ellipse, we might naturally give just such a definition.

  It boils down to a discussion of nomenclature, but nomenclature is more
important than some people realize.



  Also--am I the only one wondering what second-order substitution is?
Or what first-order substitution was?

 -PD
-- 
--
Patrick Doyle
doylep@ecf.utoronto.ca
