From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin2!goblin.stu.neva.ru!reality.xs3.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: if oo programming is the roman numerals of computing why add it? Date: Tue, 9 Jul 2013 15:55:53 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <75142425-abe8-4047-a61c-2a21063db551@googlegroups.com> <15dcebb2-1057-404e-9bcd-0858f163f4e6@googlegroups.com> <1683838578395089543.295091rm-host.bauhaus-maps.arcor.de@news.arcor.de> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: loke.gir.dk 1373403354 6697 69.95.181.76 (9 Jul 2013 20:55:54 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 9 Jul 2013 20:55:54 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Original-Bytes: 4166 Xref: number.nntp.dca.giganews.com comp.lang.ada:182400 Date: 2013-07-09T15:55:53-05:00 List-Id: "Adam Beneschan" wrote in message news:a27b527a-1bbc-4b20-a22c-035cdf152fdd@googlegroups.com... On Tuesday, July 9, 2013 12:14:05 PM UTC-7, Georg Bauhaus wrote: >> Luca Cardelli's article, featured on the page, has many comments >> in favor of O-O, provided a language gets it right. If you read the >> article, you will notice that Ada's style of O-O is very much like >> Cardelli suggests it should be. >I read "Pitfalls of Object-Oriented Programming" (linked on the page) >yesterday, >and it seems his argument delves into details like memory cacheing and >branch >prediction. This was a big yawner for me. My feeling has always been that >if >you take all the extra nanoseconds that good programming techniques >sometimes >cause, you can add up all the wasted time that occurs every time the >program has >been run, anywhere in the world, maybe millions of times, and it still >won't nearly >add up to the time that would be wasted trying to track down one difficult >bug >caused by bad programming practice. >Then again, the author was from Sony Entertainment, so I can understand why >perhaps >every nanosecond might be important. Still, a good compilation system >could, in >theory, make up for the time wastage that O-O or other good programming >techniques could cause. The need to break programs up into smaller >subroutines >and modules has been recognized for 30 or 40 years, but this can lead to >small >inefficiencies when code has to contain CALL instructions instead of >executing >the subroutine inline. I suspect that people back then objected to this >important >technique for that reason. But compilers are now able to rearrange the >code to >eliminate the inefficiency. I think similar optimizations can be done for >O-O >techniques. If you have an abstract type A, but the compiler can determine >that >the only objects in A'Class (using Ada terminology, but I mean this to >apply to >any language) used in the entire program all have type B, then a compiler >could, >in theory, rearrange the code to avoid the overhead that a dispatching call >on one >of A's operations would entail. That's just one possibility; there should >be others. > Don't know if any existing compiler (for any language) goes this far. Janus/Ada uses a similar technique to eliminate the extra space overhead caused by OOP. We track down which routines are never called in a dispatching call and remove those from the tags, so that the dead subprogram eliminator that's built-into our binder can remove the subprograms. (It reduced the size of typical Claw programs by about 800K.) Since we concentrated on space rather than time issues, we never made any attempt to improve the call overhead, but clearly a similar technique could be used for that. (It's a bit harder, as flow analysis would be needed.) Randy.