Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!apple!Apple.COM!lsr
From: lsr@Apple.COM (Larry Rosenstein)
Newsgroups: comp.sys.mac.programmer
Subject: Designing a Drawing Program (was Gophers and drawing objects)
Message-ID: <4352@internal.Apple.COM>
Date: 25 Sep 89 18:52:55 GMT
References: <1989Sep23.075154.11858@agate.berkeley.edu>
Sender: usenet@Apple.COM
Organization: Objects-R-Us,  Apple Computer, Inc.
Lines: 30

In article <1989Sep23.075154.11858@agate.berkeley.edu> 
fjlim@garnet.berkeley.edu writes:
> I advise that the subview management in the TCL should not be used
> for handling graphical drawing objects.

Definitely true.  I have been working on a drawing building block for 
MacApp, and defined my abstract Shape class as a subclass of TObject (not 
TView or TEvtHandler, which I gather correspond to CView and CBureaucrat 
in TCL).

In terms of object-oriented design, it is sometimes better to create a 
brand new class rather than inherit from an existing class.  It is 
sometimes very difficult to decide which is better.  I think you have to 
consider the type relationships of the various classes and not just look 
for a way to share code.

For example, MacApp provides a class that implements a list of objects 
(TList).  If you wanted to define a class that represents a list of 
shapes, it would seem that you should make it a subclass of TList.  

It is probably better to define TShapeList as a subclass of TObject and 
have it contain a TList object.  That way TShapeList is a brand new type 
unrelated to any other type, and you can define the methods appropriate to 
a list of shapes.

Larry Rosenstein, Apple Computer, Inc.
Object Specialist

Internet: lsr@Apple.com   UUCP: {nsc, sun}!apple!lsr
AppleLink: Rosenstein1