[OpenLayers-Dev] coding style best practices
crschmidt at metacarta.com
Mon Oct 1 16:43:46 EDT 2007
On Mon, Oct 01, 2007 at 04:28:15PM -0400, Paul Spencer wrote:
> I am not a particularly fastidious coder but I do strongly believe
> that folks should be making their code readable and, as much as
> possible, avoid common sources of bugs. Also, for those folks
> looking to make contributions, it is going to be much easier for the
> core maintainers to bring your code into trunk if it already fits the
> coding style of OpenLayers.
> I am sure Chris will have more to say on this, but my particular pet
> peeves are:
Erik will much more so than me :)
Both of Paul's points are dead on, and some others:
* Wrap lines at 80 characters. I'm less picky about this than
Erik, but he'll go through and clean up the code later if you don't
do it, and his commit statistics are inflated enough without giving
him more material ;)
* Comments when you're doing something confusing are helpful.
Don't write a novel, but also don't leave the next guy wondering what
was going on. (And as always, a key when commenting is "Not how, but
*why*.") I screwed this up with one change I made around r1400, and
we've been paying for it for 3000 commits.
More information about the Dev