On 3 Aug 2001 22:59:27 GMT esteemed Mama Cass Elliot did hold forth thusly:
> > No, that would require too much code duplication.
>
> But the *logical* path would be separate, wouldn't it?
If an existing class is reusable and is being successfully used for one
purpose does that automatically mean that when the class is used for some
other purpose bugs or unforeseen consequences won't be found? No, of course
not. The problem is that when new features are added they can't have their
code written from scratch. They have to rely in various piecs of code that
already exist.
Reuse saves coding time and makes the program smaller. There is never enough
time to write all the code to do all the things that people want an
application to do. So reuse of existing classes is essential. But then some
feature request may come along that doesn't map well to the existing code
base.
>
> So Mozilla has a fancy means of cutting down on duplicated code - that
> makes, IMHO, a complication of detail for the sake of cutting down on the
> amount of code, but doesn't make the logical flow any more complicated -
> it's just a diversion in the hose, imho. :o)
If one person makes a change to shared code to fix one bug he can inadvertently
create a problem for some other higher level operation that uses that same
lower level code. Sometimes a bug that messes up one part of the program
can actually benefit another part.
> >>Wasn't this the whole reason behind Mozilla's modular design?
> >
> > One reason anyway.
>
> What were the other reasons?
One breaks things up into modules for a number of reasons. Here are a couple:
1) To allow more programmers to work in parallel without getting in each
other's way.
2) To better identify functionality that more than one part of the program
needs. This helps for a couple of reasons:
A) Less total code needs to get written.
B) Less total code needs to be debugged.
But then you have to make sure that changes in a module for the benefit of
one use do not mess it up for the benefit of some other use. Sometimes just
the need to add more arguments to a function call for one use may make it
necessary to go to all the other places where a function gets used and add
the same argument to pass in.