bovine | 1 Mar 2003 02:45
Picon

Re: enforcing coding style

Nothing wrong with a coding standard, especially if everyone is reasonable about it and actuallly uses it.
 
I am picky about naming things and commenting, not about the location of brackets or some forms of spacing.
 
At my current employer I have to write my code following a standard that is super-picky about spacing between things, and code reviews have basically become expensive meetings along the lines of: "on line 112 there is a space at the end of the line." and: "on line 112 there are 2 spaces in the comment between the words will and then.".
Since I am an engineer 'on loan' to this team in another city, and the code review took the role of spel-checker, I asked if they were using some sort of autodoc software on the code and the answer was: "No, it's just a coding standard.". There is also very little source commenting.
 
See, when code reviews become spacing and spelling 'bitch sessions' without any mention of code structure, design or errors, then it just gets in the way of the work.
 
Best Regards,
Jeroen
 
PS: (since everyone's doing this 'ps' thing..) brackets on whatever line you like! TABS are A-OK! :)
 
 
----- Original Message -----
Sent: Saturday, March 01, 2003 6:22 AM
Subject: RE: [Sweng-gamedev] enforcing coding style

I disagree that enforcing a code standard is a Bad Idea.  I was against a coding standard at first, but after have using one for a few years, I love it.  Have a *consistent* coding style most certainly is MUCH better then "everyone doing their own thing with every file using a different standard."

If people don't "buy into" a standard, they won't use it.  What we found to work reasonable well, was to come up with a common coding standards where everyone was allowed to contribute their ideas and preferences.  We then had everyone (mostly) agree upon what style they would like -- with our Chief Architect as arbitrator -- since he had written more code then any one of us.  This way, most people will follow the standards most of the time, if they don't have to make too many changes to adapt to the new style.

We also have a doc++ macro that "enforces" a standard as well.  Spend a day getting it written - you will find it to be very helpful over the years.

Even if your coding standard is as simple as agreement(s) on:
- Comment blocks & Function line separators
- naming practices, for globals, pointers, statics, templates, enums.
i.e. p for pointers, s for statics, _ for member variables, etc. (Yes, a slight use of Hungarian Notation makes things more readable, not overzealous use which is overly complicated and cluttered.)

- Bracket placement
- White space, and alignment
- Tab size

If someone has issues following something as simple as standard coding practises, are they actually helping the team in the long run?

Cheers

-----Original Message-----
From: J C Lawrence [mailto:claw <at> kanga.nu]
Sent: Friday, February 28, 2003 1:03 PM
To: sweng-gamedev <at> midnightryder.com
Cc: sweng-gamedev-midnightryder.com <at> lists.midnightryder.com
Subject: Re: [Sweng-gamedev] enforcing coding style


On Fri, 28 Feb 2003 10:27:39 -0500
Eric Preisz <epreisz <at> d-a-s.com> wrote:

> Enforcing coding style is quite an arduous task when forcing coders to
> conform to a style doc.  Maybe Castro could do it, but I'm not much of
> a dictator.

Then don't.  Period.  Bad Idea with very few to no gains.


Gmane