3 ms·
The trouble with the C++ paradigm that the implementor of a class does a bit more work so that the user of a class doesn't have to is that it's recursively extr
by phaedrus 19y ago
The trouble with the C++ paradigm that the implementor of a class does a bit more work so that the user of a class doesn't have to is that it's recursively extra work: I do extra work in a low-level class so it's user can do less - but wait! I'm the user of this class. And in the class in which I use the class I just worked hard on, I further have to do extra work for the benefit of the users of the second class. And so on - a hall of mirrors of extra work. Not to say that it's zero-sum, but the effect is more one of shifting the work downward in the hierarchy and I only get a net benefit if I reuse the most basic classes roughly at least 3 times. Not all classes are created for re-use; some are created just to divide up the code into smaller human-readable chunks, and that's where the extra work for the implementor of a class is more overhead than it saves.