POV-Ray : Newsgroups : povray.off-topic : Hypothesis: OO does nothing for reusability : Re: Hypothesis: OO does nothing for reusability Server Time
7 Sep 2024 09:23:32 EDT (-0400)
  Re: Hypothesis: OO does nothing for reusability  
From: Darren New
Date: 21 Aug 2008 11:47:57
Message: <48ad8e2d$1@news.povray.org>
Invisible wrote:
> Darren New wrote:
> 
>> (I count "reuse" as the ability to take code already written and use 
>> it in ways not anticipated when it was written.)
> 
> Isn't that "extensibility", not "reusability"? You want to *extend* 
> existing software to do something it wasn't designed to do.

Well, the claims of the OO proponents were that the extensibility (via 
inheritance) would make the reusability much better. (Along with the 
encapsulation, of course.)

Extensibility is actually something different, when speaking in 
technical terms. Extensibility is the ability to add your own 
domain-specific stuff to your environment and have it have all the 
powers and basically be indistinguishable from the stuff that is 
privileged to come with the environment. E.g., there's nothing built-in 
functions can do that you can't, there's nothing programs that come with 
the OS can do that your programs can't, etc.

>> But particular OO libraries are IME limited to doing exactly what they 
>> were designed to do, without really being any more extensible than a 
>> procedural language with carefully crafted callbacks.
> 
> You're still talking about "extensible", not "reusable".

Well, no.

> With any half-decent OO language, this problem immediately goes away. 

Not really. Not in C++ or Java, for example. (Yes, you can do it in C++, 
but not because of the OO nature of it.)

> You can now write a sorting algorithm once for each container type (or 
> even once overall if you desire, but that's probably less efficient) and 
> you're done. This one sorting algorithm can then be reused anywhere you 
> need to sort data.

I can already do that in C. Look at the qsort routine. You're not 
talking about OO here. You're talking about how statically typed 
something is regardless of whether it's OO.

> These days OOP isn't the only paradigm that actually offers this 
> benefit, but the benefit is real none the less.

There are definitely benefits to OO. Being able to reuse existing code 
by subclassing it and overriding just that which isn't quite right (when 
the original designer hadn't anticipated you'd subclass it in that way) 
isn't one of them.   Certainly less so than some of the other mechanisms 
that have been invented without nearly as much hype.

-- 
Darren New / San Diego, CA, USA (PST)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.