In article <11*********************@m58g2000cwm.googlegroups. com>,
santosh <sa*********@gmail.comwrote:
>The program is probably poorly designed if repeated operations need to
be performed on several varyingly named objects.
I don't seem to catch the reasoning on that "probably poorly designed" ?
Is it not the case that any for() or while loop involving more than
one variable has "repeated operations" that "need to be performed
on several varyingly named objects" ?
Even if you meant to only talk about performing "the same operation"
on several different objects, I can think of many occasions when I would
not deem it "poor design" to perform "the same operation" on multiple
variables. Adding a routine to perform the operation on a single
variable and then calling the routine repeatedly usually does not come
for free.
Consider for example the simple example of having a long list of
[x,y] pairs and that the x and y values must be individually summed.
If one uses a routine to total one of the components and calls it
twice, then the long list must be traversed twice, with all the cache
effects that implies -- and if it is a linked list, with noticable
pointer work. Is it really such a bad design to use a single
routine that iterates over all the members and sums the
"several varyingly named objects" in individual statements? Is
the meaning unclear? Is it hard to debug or maintain or document?
Worse than introducing a new auxillary routine just for this
one purpose?
--
There are some ideas so wrong that only a very intelligent person
could believe in them. -- George Orwell