home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!van-bc!eosvcr!aew
- Newsgroups: comp.object
- Subject: Re: Object-Oriented Methodologies - Class Specifications
- From: aew@eosvcr.wimsey.bc.ca (Alan Walford)
- Distribution: world
- Message-ID: <q9aHqB1w162w@eosvcr.wimsey.bc.ca>
- References: <715276480.1.p00058@mail.psi.net>
- Date: Wed, 02 Sep 92 07:54:01 PDT
- Organization: Eos Systems Inc, Vancouver, B.C., Canada
- Lines: 49
-
- "Ronald C. Schultz" <p00058@mail.psi.net> writes:
-
- > Object Coupling - In order to better support reuse, objects should be as
- > decoupled as possible from any specific application, so that they may be
- > reused in as many applications as possible. In Rumbaugh's OMT text he
- > provides a class specification for a circle on page 290. I quote:
- >
- > ---- start of quote -------------------------
- > Class Description
- > Class Name: Circle
- > Version: 1.0
- > Description: Ellipse whose major and minor axes are equal
- > Super Classes: Ellipse
- > Features:
- > Public Attributes:
- > center: Point - location of its center
- > radius: Real - its radius
- > Public Methods:
- > draw (Window) - draws a circle in the window
- > intersectLine (Line): Set of Points - finds the
- > intersection of a line and a circle, returns set 0-2 points
- > area(): Real - calculates area of circle
- > perimeter(): Real - calculates circumference of circle
- > Private Methods: none
- > ---- end of quote --------------------------
- >
- > This class specification screams of unnecessary object coupling. Why,
- > for instance, should a circle need to be aware of the existence of
- > lines? or of the existence of windows? To me, this class violates the
- > very concept of a circle as defined in any geometry text.
- >
-
- My feeling is that Draw should not be in the class. An operation that
- is very dependent on a user interface should be decoupled from a model
- class like "Circle". Draw should be in a UI class like a "View". You can
- see I follow the Model-View-Controller (MVC) paradigm quite a bit.
-
- My question is where does intersectLine go? Does it go with Line, with
- Cirlce, with an application View or with some other class ?
-
- It should _not_ go with the application since line and circle intersection
- is application independent. One would not want this sort of coupling to an
- application (loss of reuse). But if you do not like it going with Circle or
- Line, where does it go? A Transform class perhaps ?
-
- Al
- ----------------------------------------------------------------------------
- Alan Walford Eos Systems Inc., Vancouver,B.C., Canada Tel: 604-734-8655
- aew@eosvcr.wimsey.bc.ca OR ...uunet!wimsey.bc.ca!eosvcr!aew
-