I could go on all day about this one. I just had to start a thread on it. There is a proliferation of poor code in the world. I’ve recently had opportunity to see some potentially horrendous examples of code used in actual commercial products. (no names will be mentioned).
There are of course many ideas about how strictly managers should enforce coding standards. One extreme is that style is just a matter of taste and nothing matters except testable results. i.e. If the code passes unit tests and functional tests, then that’s good code.
Needless to say I disagree… I think style = maintainability. One day the person that created this code will be gone. Someone else will inherit it. The faster that person can look at and understand the flow of that code the better.
Here are some things I’ve seen in code I’ve inherited:
(more…)