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 X-Received: by 10.224.172.129 with SMTP id l1mr14029221qaz.4.1373398982257; Tue, 09 Jul 2013 12:43:02 -0700 (PDT) X-Received: by 10.50.9.40 with SMTP id w8mr1448960iga.4.1373398982030; Tue, 09 Jul 2013 12:43:02 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.bbs-scene.org!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!t19no922949qam.0!news-out.google.com!f7ni1805qai.0!nntp.google.com!t19no967351qam.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 9 Jul 2013 12:43:01 -0700 (PDT) In-Reply-To: <1683838578395089543.295091rm-host.bauhaus-maps.arcor.de@news.arcor.de> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ NNTP-Posting-Host: 66.126.103.122 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> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: if oo programming is the roman numerals of computing why add it? From: Adam Beneschan Injection-Date: Tue, 09 Jul 2013 19:43:02 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:16222 Date: 2013-07-09T12:43:01-07:00 List-Id: 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=20 > 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) yeste= rday, and it seems his argument delves into details like memory cacheing an= d 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 techn= iques 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 ti= mes, and it still won't nearly add up to the time that would be wasted tryi= ng 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 sy= stem 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 sma= ller subroutines and modules has been recognized for 30 or 40 years, but th= is can lead to small inefficiencies when code has to contain CALL instructi= ons 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 abstr= act 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, rearr= ange the code to avoid the overhead that a dispatching call on one of A's o= perations would entail. That's just one possibility; there should be other= s. Don't know if any existing compiler (for any language) goes this far. -- Adam=20