Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uwm.edu!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!johnson From: johnson@m.cs.uiuc.edu Newsgroups: comp.object Subject: RE: Should objects draw themselves? Message-ID: <77500047@m.cs.uiuc.edu> Date: 9 Aug 90 12:24:00 GMT References: <12873@rouge.usl.edu> Lines: 31 Nf-ID: #R:rouge.usl.edu:12873:m.cs.uiuc.edu:77500047:000:1359 Nf-From: m.cs.uiuc.edu!johnson Aug 9 07:24:00 1990 >>QUESTION: Should a `Shape' be able to `draw' itself? >>The usual answer is ABSOLUTELY. ... >>However: what if I add a new terminal type? Or what if I want a textual >>... >I agree somewhat, but consider the following. What happens when these >objects have to draw themselves in relation to other objects, i.e. if >objects have priorities (such as in a graphics system where farther objects >are drawn first 'painters algorithm')? Double-dispatching solves the problem of different terminal types nicely. See Ingall's paper in OOPSLA'86, or my paper in the March/April issue of JOOP this year. When life gets even more complicated, I fall back on the "mechanism, not policy" advice that was given earlier. Complex behavior requires complex designs, and 3D graphics requires other objects to represent things like perspective. If you want to see how to handle 2D graphics well, you might look at [VL89] John M. Vlissides and Mark A. Linton, "Unidraw: A Framework for Building Domain-Specific Graphical Editors", Proceedings of the ACM User Interface Software and Technologies '89 Conference, November 1989. Has anybody seen any papers on object-oriented designs for 3D graphics? In my opinion, papers that describe particular designs are very important and there should be more of them. Ralph Johnson - University of Illinois at Urbana-Champaign