[Mapserver-dev] Coding Standards
dgraham at i3.com
Fri Feb 28 11:09:28 EST 2003
Not sure how people feel about this, but I have been on projects where
each night before the daily build the entire tree is checked out.
"indent" is run with a set of project format rules. Then all the changes
are committed (only those that indent changed the format on). Then the
daily build is performed. And finally the unit tests are executed.
This ensures that all code ends up in the same format. Developers do
need to remember to update their CVS in the morning to get formatting
changes. This is actually quite important, otherwise you find yourself
doing a lot of CVS merge repairs (my biggest complaint of this
technique). As a result programmers start programming more to the
standard just to avoid problems with CVS merge failures.
Just a thought, of course I am not directly in the development circle
for this project so do what you want.
>OK, here my 0.02 worth.
>I would like to see a more standardized coding style; but I'm not
>particularly adamant about it.
>What I would really like to see changed is indentation and curly braces
>on the same line as the statement beginning a block. I am a fan of tabs
>rather than spaces, at 4 characters, but if the majority of folks would
>rather spaces then I can live with spaces. The curly brace thing really
>is a biggie for me, though. I really struggle to figure out block
>structure without it.
>From: Daniel Morissette [mailto:morissette at dmsolutions.ca]
>Sent: Wednesday, February 26, 2003 2:38 PM
>To: Steve Lime
>Cc: mapserver-dev at lists.gis.umn.edu
>Subject: Re: [Mapserver-dev] Coding Standards
>Steve Lime wrote:
>>Subject says it all. Depending on who wrote the code rumaging through
>>the source can be kinda trying. I'm thinking we need a document that
>>lays out coding standards, especially as the list of developers grows.
>>For example, I like the naming convension that some folks use for
>>function parameters and local variables and would like to adopt that
>>myself. However, I (personally) hate if-then's or function calls that
>>span multiple lines- have to scroll too much when editing. Thoughts?
>I agree that a common coding style would be very welcome. I attached
>below the bases of the coding style that we try to follow at DM
>Solutions, it also matches what Frank uses for his libs (GDAL, OGR,
>shapelib, etc.). You'll notice that it's extremely simple, just enough
>to keep the code clean without making it too complicated for new
>developers to learn and follow the rules.
>I'm not saying MapServer-Dev should adopt this coding style, but of
>course it would be easier for us if we did. ;) I'm sending it to the
>group as a base for discussion.
>I would like to elaborate more but I'm taking off right now and will be
>back only on Monday. I'm sure others will have many ideas. Hopefully
>Frank and Assefa will defend the value of this coding style in my
>P.S. Contrary to you I have don't like if-then blocks that start at the
>end of the line and I much prefer having brackets on separate lines, but
>that's just a natural preference and I respect your choice.
David W. Graham
Director of Geospatial Applications Development
information integration and imaging, LLC
201 Linden St, Third Floor
Fort Collins, CO 80524
dgraham at i3.com
More information about the mapserver-dev