BC The coding standards are interesting. I’m a bit of a waste of columns, and we have eight character tab stops. style fascist. When you automatically enforce that, you are forcing a EA I am, too—and I’m right and you’re wrong. refactoring to occur. You identify the stuff that should BC You’re a bit more of a bellicose style fascist than I am. probably be offloaded to a separate function or method. We might have the same style, who knows? Do you auto- One of the things that I really bridle at is exceeding 80 matically enforce style? columns—bridle being a euphemism for either self- EA We don’t have tools to do it. I actually got involved destruct or, I don’t know, go on a berserker rage. in coding styles back when I was working on the INGRES EA Remember your blood pressure meds. database project. What we found was that every time BC Thank you. Fortunately I’m medicated today. When someone new joined the project, they spent the first you allow people to go into 133 columns, or longer, you couple of weeks reformatting the code to be in whatever allow a kind of laziness where someone can load a single format they liked, which has all kinds of implications. A line up with so much information or get too deeply waste of time is one of them. Another one is diffs don’t nested. Eighty columns and eight-column tab stops

BRYAN

ERIC

STEVE

 

work anymore, so you can’t really see what they’re doing. So, we decided we had to have one style that would be used throughout the system. I worked with another guy on the project there and came up with the coding style that sometimes is called ANF (Allman Normal Form), which I have adapted a little bit over the years as new syntaxes have come along.

STEVE BOURNE Let me just take a slightly opposing point of view for a second. I’ve managed engineering shops in which we’ve enforced coding styles through tools so that people can read other people’s code, but that seems to be about it. It doesn’t actually make the code work, and it doesn’t actually make it structured well, either, so what’s the point?

BC The point is much larger than readability. First of all, readability has an impact on correctness. If I can read code, I can see things that are wrong with it.

We believe that on the eighth day, God created 80 columns, and ye shall never exceed 80 columns. How does being fascist about 80 columns affect anything? Well, it actually affects the way you write code. When you need to fit within 80 columns, having a 75-character variable name is probably not such a good idea. It’s probably a

doesn’t really allow more than four levels of indentation as a practical matter, and that is a good thing from a code structure perspective.

SB I like the principles that you just described because they actually produce, on average, reasonable results, as opposed to the crude tools we have for forcing people down these channels. BC Right, and I think to a certain degree, it doesn’t matter which style you pick. EA Up to a point. BC Eric, don’t you guys do an interesting thing with bracing IF statements? EA That’s the most controversial part of it. The argument for putting the open brace on the line with the IF statement used to be because that way you can fit more on a screen. Today monitors are big, so that’s just not an issue. But I’ve never felt that that was a good argument. If you can drop your eye and see the curly braces line up, it actually makes it easier to see the nesting. BC I agree with you. We don’t actually enforce it—in fact, it would be a violation of our style to brace the IF on a separate line—but my personal style is to use braces if I have in the body of an IF statement a conditional that is

References:

mailto:feedback@acmqueue.com

Archives