3 ms·
There is a lot of truth to that, although I also see a third trade-off, which is robustness to change (not so much in the code but rather the inputs). I think
by js8 8y ago
There is a lot of truth to that, although I also see a third trade-off, which is robustness to change (not so much in the code but rather the inputs).
I think you can have in some cases efficiency and elegance, but then the solution will be either too abstract or specialized that it won't really be practical, and a small change in problem conditions will cause it not to work. (An example from the article - a matrix solver that only does a well-conditioned systems so the floating point errors never accumulate.)
Similarly, you can have robustness to change and elegance without efficiency (mathematically beautiful code), and robustness to change and efficiency without elegance (lot of copy pasting the code to deal with special cases).
In any case, I think we are generally trying to present elegant code to humans (using more abstract programming languages) and then use compilers to convert the elegance into efficiency. But it requires that somebody takes the pains to actually deal with all the possible cases (and write a working compiler).