Strong opinions, weakly held

Menu

The argument against coding standards

Richard Rodger argues that you should toss out the coding standards and let programmers express themselves. I’ve been a fan of coding standards in the past but I find myself changing my thinking on this front. These days, I look at a lot of code written by people whose coding styles don’t particularly appeal to me. I manage. It’s fine. I just don’t think it’s as big a deal as I once thought it was.

4 thoughts on “The argument against coding standards”

The only time I think coding standards are enforceable is if the tools the developers are using automatically format the code as appropriate. It is a complete waste of brain power micro-managing whitespace.

I think a little bit of room to experiment is a good thing, and bad coding standards worse than none, but a good, sensible, argued-about standard that remains open to discussion is a good thing.

By coding standard I mean things limited to the syntax and layout of code, naming of variables, classes, methods, and packages, and the use of certain standardized general-purpose libraries, but not specific mandates to use certain systems or services, which are almost always a bad idea.

Andy’s point about automated refactoring is probably important to C++ and Python but not really for Java or Go, which have a more regular syntax that can be unambiguously parsed without much context. Go of course takes this to an extreme by mandating a single canonical source code format (which is a good idea, wish the same could be done easily in Java).

Perhaps it’s that I work in Java these days and there isn’t much stylistic variation that makes any difference there, but I don’t feel cramped by operating under a quite strict coding style that I played no part in developing. In fact I appreciate it a great deal because it heads off many pointless arguments over matters of taste, leaving you more time to argue over more substantive things (which are mostly also matters of taste too, but at least they mean something).

One important drive towards program standards is the everything-but-programming industry. Rather than focusing on getting good working code, they focus on programming methodology. It’s great work if you can get it. You get more respect from management than any actual programmer, and you don’t have to actually produce any working code. What’s not to like?

Of course, if the goal is shipping something with code in it, that’s a whole different issue.