Every few years, there are fashions in our industry that feel like moral virtues to follow; structured programming, object orientation, patterns, functional, TDD, IoC. They warm the cockles of your heart, make you feel good about yourself.
But I am suspicious of this feeling, because it is an emotional in-group attachment, a bit like a religion. All religions have costs to following them, so that disbelievers may be easily recognized and (to a greater or lesser degree) demonized. But the world isn't and shouldn't be so black and white. Actions should be analyzed more carefully, and above all, rationally.
Code structured in a fashionably virtuous way makes me suspicious that the situation may not have been analyzed dispassionately. The style may be an end in itself.
I'm especially on guard because I used to be an acolyte of the OO religion.
All of the 'fashions' in the list are alive and well, in one form or another and (usually) helping someone. While the dogma eventually does wear off, there's almost always something that can be taken away from each of the approaches.
The religion aspect stems from individuals and organisations finding that a certain approach works really well in one case and thinking that blindly applying the same techniques will result in the same good outcome in all cases in the future. This is worsened by managers (+developers) wanting to make software creation/maintenance more predictable and less ad-hoc (I mean, just look at how the average civil engineer approaches large projects to see how chaotic/immature most software development processes are - this is the case for pretty much every professional occupation except software). There are obvious constraints that make software difficult, but it's this search for something better that gives these fashions, and it's IMO really only the shortsighted or foolish that wake up one day and decide to apply only one of the approaches across the board on all of the lines of all of their applications.
It's all about having a light touch - there's nothing wrong with structured programming, OO, patterns, functional programming, TDD, IoC, etc. because they're really only tools that come in handy sometimes. You don't need to worship the ideals at all times, just use them when they're convenient or beneficial.
Actually this one is alive and well, although it might be hard to see as we have built huge complex structures over it.
We still follow its basic principles - one entry point per subroutine, no jumps into middle of loop body, no jumps into branches of "if", only the subroutines are sometimes called procedures, methods or functions.
Even those who program directly in machine code seldom break the above commandments.
I sometimes even use goto, as well as break, continue, and return before the end of the function.
Bite me.
;)
(SP adherents used to advocate using flags instead of breaking out of loops explicitly, amongst other things. It's this kind of virtuous action for the sake of the virtue, rather than anything that necessarily makes sense, that I'm talking about.)
But I am suspicious of this feeling, because it is an emotional in-group attachment, a bit like a religion. All religions have costs to following them, so that disbelievers may be easily recognized and (to a greater or lesser degree) demonized. But the world isn't and shouldn't be so black and white. Actions should be analyzed more carefully, and above all, rationally.
Code structured in a fashionably virtuous way makes me suspicious that the situation may not have been analyzed dispassionately. The style may be an end in itself.
I'm especially on guard because I used to be an acolyte of the OO religion.