3 ms·
Thing is, computers were build to handle scientific problems. And it shows in numerical programs, a especially egregious example was a simulation program with ~
by yk 12y ago
Thing is, computers were build to handle scientific problems. And it shows in numerical programs, a especially egregious example was a simulation program with ~1k LOC main. However it is possible to work with that since it has a lot of structure, that main routine looked something like
main(){
initMatrix(reasonableName);//Repeat this block
loadData(reasonableName);// 100 times.
for(){
someBookkeeping(reasonableName);
//Another 100 lines
for(){
numericalStuff(reasonableName);
//Again repeat 100 times
}
}
cleanUpAndOutput(reasonableName);
//Again repeat 100 times
return 0;
}
So that is of course horrible code, but at least it is horrible in a consistent way. I got really burned by code where the high level architecture was build by a software engineer and the details were filled in by a physicist. Then you get atrocities like should be separated classes that spread their functionality over multiple levels of inheritance. ( Along with several pages of a constructor...)