lsr@Apple.COM (Larry Rosenstein) (09/26/89)
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