POV-Ray : Newsgroups : povray.off-topic : Hypothesis: OO does nothing for reusability : Re: Hypothesis: OO does nothing for reusability Server Time
7 Sep 2024 03:22:49 EDT (-0400)
  Re: Hypothesis: OO does nothing for reusability  
From: Invisible
Date: 21 Aug 2008 04:05:25
Message: <48ad21c5$1@news.povray.org>
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.

> 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".

In a classic procedural language like, say, Pascal, it is basically 
impossible to write a reusable sorting algorithm. That's because Pascal 
is a monomorphic language, so it forces you to write SortIntArray(), 
SortRealArray(), SortStringArray(), SortIntList(), SortRealList(), 
SortStringList(), SortIntDList(), SortRealDList()... are you getting 
bored yet?

With any half-decent OO language, this problem immediately goes away. 
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.

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

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

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