August 27th, 2005, 6:05 pm
We've already reached the point where the way that the programs are structured are not very closely connected with the underlying hardware.Yes, at one level I agree.However a vast % of code is For.. loops which map directly to the hardware, and is very much of the form1: Get data2: Screw with it3: If it's nice stop else goto 14: Find some other bit of data5: screw with it in a similar way, but using different code6: find some way of nailing the two bits of data together7: give upThat's what 99% of general purpose CPUs think the world should work like.Things like threads and arrays are actually again direct mappings of processor concepts.Nearly all code on (say) matrices is actually written as For loops as well. Yeah I know we have higher level concepts, but look at the code people actually write.Pentium style CPUs can't do lazy evaluation without considerable poking, and as for parallel operations, dream on.The trouble is that there are usually dozens of ways of breaking up a problem, and in the case of OOP, the main difficulty is less coding an algorithm, but rather structuring the code so that people will be able to extend, fix, combine with other modules after six or seven years. One problem with academic code is that it tends to be written by a small number of people and code maintainability, extensibility usually isn't taken into consideration.The main point of writing clear elegant code is not to try to explain yourself to the computer (since the compiler will take care of that) but rather to explain what you are trying to do clearly to the people who are going to have to debug, maintain, extend what you have written with a minimum of effort.And of course "the people" in this context includes you 6 months from now.