The ironic thing about the tens of hours each month i put into improving my code is, my boss and colleagues probably won’t say my code is quality code.
My boss is likely to notice design “problems”. Any design is the product of trade-off, sacrificing some benefits for other benefits. I think my boss can be pretty fast to notice the sacrifices.
Look at it this way — If u don’t like a design, u won’t notice code quality, will you? Actually this question depends on what you consider “quality”.
I have such a long-standing habit of self-review, which is now a liability, not an asset, because it takes hours but doesn’t earn me much
– decide whether to use private or protected when both can work
– shorten method arguments
– reduce dependency between objects, when most people won’t notice the improvement
– improve output messages, to help support job (like your job now)
– reduce repeated output messages
– make log messages more consistent among different modules, so the support guy have fewer surprises and confusions. For example, “duplicate” or “non-unique” and “already exists” mean the same so i use only one of them.
– give more meaningful/consistent variable names,
– combine and merge variables — A lazy/busy programmer can make 50 variables (instead of 20) to hold 50 things. Except the author, a normal brain can’t keep track of so many unstructured variables.
– choose appropriate error-handling, such as email, log, crash, throw/re-thorow, “continue” or “break” or return an error code, when each option can work
– wipe up left-over code that is no longer in use
– remove code duplication — Don’t Repeat Yourself
– clear memory to help garbage collector reclaim memory
– check for nulls
… Most of this extra “polishing” is perhaps unproductive in the eyes of my team members. I think this is another reason i feel the workload is 2-3 times higher.
Outside fast-paced wall street, perhaps this “polishing” is more appreciated.