|
|
Darren New <dne### [at] sanrrcom> wrote:
> Um, yes, I know, thanks. But in the early days, it was claimed that
> making something OO would make it easier to reuse in new projects.
Obviously we should assume the word "properly" in there.
One could say that if you write a class which is *not* reusable, then
your OO design is bad.
> > I really can't see how memory management has anything to do with
> > reusability. Just because something has automatic memory management
> > doesn't make the code any more (or less) reusable.
> Memory management makes things easier because you can treat objects as
> entities. If the object comes with its own mechanism for deallocating
> the memory when it's no longer needed, then your library doesn't have to
> implement that and your callers don't have to enforce it.
Still can't see what this has to do with reusability. Reusability is
a question of design, not a question of memory management.
> Or are you telling me it's not easier to write libraries in C++ than in
> C because of the destructors? Would C++ be that much easier than C if
> you didn't have destructors?
Still can't see the connection to reusability.
Perhaps you are confusing "reusable" with "easy to use"? Different things.
> Having memory management built in to some degree isolates you from
> having to know what's inside the object to that degree. You don't have
> to say "when you're done with this, call DisposeMyThing(mything) to free
> all the memory allocated." If you actually have something like GC, you
> can say "and don't worry if I've formerly returned a pointer to
> something inside, or if you passed me a pointer to something outside."
Still related to ease of use rather than reusability.
> > The one thing which OOP has contributed greatly to reusable programming
> > is the concept of modules. (Not really an "invention" of the OOP paradigm,
> > but it's the paradigm which made it available to the masses.)
> The idea of modules was around long before OOP. :-)
Didn't you read what I wrote in parentheses?
> They were called "libraries".
When I say "module" I'm referring to a much more concrete entity than
a generic "library". I'm talking about modules as per the modular programming
paradigm.
Some people call C header+source file pairs "modules", but that's not
the kind of module I'm talking about. That has little to do with the modular
programming paradigm.
> I'll argue that other paradigms are even easier to write reusable in.
I'll believe it when I see it.
--
- Warp
Post a reply to this message
|
|