One might suggest that every good programmer, if they spend enough time improving, eventually moves toward a more functional programming style.
Yeah, functional programming was all the rage in 640K with no on-chip cache hierarchy.
Good grief, functional programming predates the modern OOP idiom. John Backus's FP dates to 1977. I was already proficient in APL which made reading his papers a fairly easy exercise. All this before C++ first appeared in 1983. I wrote all my code for the rest of the decade in C with C++ influences (a manually coded object as the first function parameter for most functions). Hardly ever used an FP technique. We used to story-board memory flow like an underfunded Hollywood picture. We didn't code in Howard Hughes FP movie-making style a la Hell's Angels where he had a stupidly large number of cameras covering the arial stunt-work, IIRC from The Aviator special features chitchat.
What movie maker ever turns down twelve camera coverage if you get it for free? Unfortunately, in 640K there are no free camera angles. You've probably borrowed your camera from some studio over the weekend like Ed Wood might have done, hoping they won't miss it over the weekend. One develops habits that work and continue using them as the world changes around you. Some directors acquired a knack of working successfully with one camera, back when film was expensive. It's not such a bad thing.
Challenge of the day: Efficiently implement Knuth's Dancing Links algorithm in a pure functional idiom.
One coding technique I like in C/C++ is to reverse the logic of the if predicate so that the less typical condition comes first, often with just a bare statement (no braces) to deal with it, followed by an else clause with braces, that is usually longer, and sometimes quite long.
The following looks annoying vertical looking to me.
if (cond1) {// main case
if (cond2) { // main case
; // lots of stuff
}
else {
; // one statment
}
}
else {
; // one statement
}
Can you really get into trouble leaving out some braces with the inverted structure as follows?
if (!cond1) // rare case
; // one statment
else {
if (!cond2) // rare case
; // one statement
else {
; // lots of stuff
}
}
These discussions of style usually just piss me off. Often you get some relatively profient coder blind to his own working methods (to say nothing of the working habits of others) making general observations that are nowhere near as general as they first appear.