Too many coding standards : T-SQL Tuesday #151
4June 14, 2022 by Kenneth Fisher
One of my favorite people, Malathi Mahadevan (blog|twitter), is our host this month and she’d like to talk about coding standards. Specifically what coding standards are appropriate where we work.
My company has coding standards. And most people even follow them. However, it would almost be better if we didn’t.
I work for a large company, thousands of employees, hundreds of them in IT. And we have dozens of development teams. To make it even more fun, we have frequent movement between the teams. A person might be on one team this year supporting applications A, B, and C and on a different team the next year supporting applications A (because the application was moved too), X, and Y.
I’m betting you can start to see the problem right? Joe is supporting application A. His team wrote it, and they wrote it using a strict set of coding standards. Jane supports application C. Her team didn’t write it, it was transferred over during the reorg last March. Her team has a set of coding standards they enforce, unfortunately, application C wasn’t written with them. All of their new code is however because their manager wants strict enforcement of their coding standards. Oh, and Joe and Jane are both being moved to be part of a new team next week. They’ll be supporting some older code, that, you guessed it, is using a whole different set of coding standards, if any.
In the end, coding standards work best in isolation. Two sets of coding standards on the same set of code is confusing. Over time, when a third, fourth, fifth, etc get added in you might as well not have any.
That’s where we’re at. If I had complete control what would I do? Honestly, I’d love to see senior management put aside some budget to get a group of people together to make, enforce, and stick to, something company wide. It would still probably take a decade or more before we saw any real progress but at least it would be a start.
[…] Kenneth Fisher points out the downside of coding standards: […]
[…] tip on updating statistics after importing a large number of rows. Well done, Deepthi!Ken Fisher talks of organizational politics with standards – and the importance of having one set of standards […]
What I try to instill in our development teams is that when there is a functional or performance reason for altering a stored procedure, we should bring it up to our current coding standards (formatting, comments, etc.) as much as is practical. That has to be balanced with not making so many changes at once that the diffs are very time consuming to code review and we avoid creating too much load on our testing teams. But we are gradually making our code more readable and maintainable. This will be an ongoing task forever, but it is hard to justify the costs of changing everything all at once.
Seems like a practical solution to me!