Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!azores!kornfein From: kornfein@azores.crd.ge.com (Mark M. Kornfein) Newsgroups: comp.object Subject: Re: C++ vs. C Message-ID: <18905@crdgw1.crd.ge.com> Date: 25 Apr 91 12:56:59 GMT References: <1991Apr24.125926.5146@asc.slb.com> Sender: news@crdgw1.crd.ge.com Reply-To: kornfein@azores.crd.ge.com (Mark M. Kornfein) Organization: General Electric Corp. R&D, Schenectady, NY Lines: 41 In article <1991Apr24.125926.5146@asc.slb.com> hargrove@asc.slb.com (Jim Hargrove) writes: > >This note is prompted by several postings by Scott Guthery, beginning >with The Emperor Strikes Lethe. I am struck by how different SBG's >experience with object oriented programming differs from my own. I >began programming in C++ about 18 months ago. Prior to that, I worked >mainly in C, though I have used many different languages over the >years. > >I believe that I am writing better programs today after switching to >C++. Here is an example: [deleted C program and text] >Obj->Display(W); > >which is better both technically and aesthetically. This example shows both the power of object oriented programming and a drawback of it. The C example is somewhat easier to debug and test than the C++ example from my experience. This is especially true if I did not write the code originally. From looking at the C++ I have no clear idea what method will be called without looking further into the Display method and seeing which display method is envoked for which object. If I needed to change the Display methods I do not even know which one's exist from this code. It is true that a good browser can help with this problem but in the real world one does not always have that or even always have access to the executable code. In the C example this flow of control is perfectly clear, I know all objects that can be handled and which piece of code displays which object. =============================================================================== Mark Kornfein INET: kornfein@crd.ge.com GE Corporate R&D Center UUCP: uunet!crd.ge.com!kornfein Schenectady, NY