Page 1 of 1

Coding standards

Posted: Mon Mar 05, 2007 10:24 am
by blackrg
Reading Joel Dehlin's recent blog entry on Interviewing, one of his comments in passing caught my attention:

"So they use a different editor than you do, or they put their curly braces in the wrong placeā€“so what?"

Out of curiosity, how many of you out there use "non standard" placement for your curly braces? I'm curious how common this might be or if it's a rare thing.

Posted: Mon Mar 05, 2007 10:25 am
by greenwoodkl
Define "non-standard" placement ;)

Posted: Mon Mar 05, 2007 10:40 am
by blackrg
I've always taken standard placement to be:

loop {
}

So "non-standard" would be anything else.

Posted: Mon Mar 05, 2007 12:56 pm
by mkmurray
I've always preferred the curly braces to line up...

method()
{
...
}

...but I don't know how common it is. I'm guessing not.

Posted: Mon Mar 05, 2007 1:11 pm
by blackrg
Actually, I prefer they line up too, and had thought it was both uncommon and also often taboo in any sort of a "professional" setting, hence why I'm asking :P

When I'm coding for myself, I line them up, when I'm coding as part of a team where someone else may actually need to look at my code, I've gone with the "standard" placement. I prefer lining them up because I find the code easier to read and to debug.

Only a few times in my life have I found myself working in what I would consider a professional coding environment, and haven't had a lot of exposure as a result. Anyone else lining their braces up? Anyone doing it in a "professional" environment? Anyone care to comment on how much variation in coding "style" has been allowed in professional group projects they've worked on (free open source working being included here)?

Posted: Mon Mar 05, 2007 1:27 pm
by rickety
For the last 15 years I have lined them up. Other members of the team do not. It has not been an issue.

Someday...

Posted: Mon Mar 05, 2007 3:23 pm
by mkmurray
Our Systems Architect on our team here has this idea that he'll never get around to implementing. :rolleyes:

We code in Visual Studio, which does have some decent automatic code formatting abilites. However, developers having different coding styles can sometimes be a problem with source control. His idea is to develop a system where only the IL code (Intermediate Language, see http://en.wikipedia.org/wiki/Image:Over ... ucture.png) is checked into source code. Then when you retrieve the latest code, the code is formatted according to your preference profile.

Great idea, he's too busy doing the real work at our company to ever implement it...

Posted: Mon Mar 05, 2007 4:59 pm
by JasonG-p40
mkmurray wrote:
method()
{
...
}
That's how I've always done it.

I've seen a number of ways used as the "standard", but this is the one that I prefer myself.