On Tue, Jan 20, 2009 at 7:46 AM, Daniel J. Lauk <[email protected]> wrote: > Now, to prevent that someone gets me wrong: I consider having code > conventions a *good* thing! They provide guidance, which is very > desirable.
I didn't get you wrong :) We are on the very same page here. > But I think the way of applying/enforcing them *does* matter and I > think that templates are the wrong one to choose. Templates don't force you to anything if you don't apply them to your IDE, and use yours instead ;) But for lazzy dev like me, if I can apply a defined template, then I'm happy ! This is all what I suggest : define a template for a couple of IDE in use, and let the users chose to apply them or not. > Anyway, in case you're interested in my approach, I did a quick web > search. Here are some promising pointers. I haven't tried any of them > yet, due to a lack of spare time: > * http://checkstyle.sourceforge.net/ > * http://jalopy.sourceforge.net/ > * http://java-source.net/open-source/code-beautifiers All of those tools are valuable. I have used Jalopy for years, and checkstyle a bit. I you are using one of those tools, that's just fine, as soon as the code if formatted when saving the file. The biggest advantages of those tools is that they can detect some code with bad smell (like 'if' without '{'). I personally think that you should use a code formatter and a template plus run either checkstyle, Jalopy, or whatever tool you like. (Btw, Eclipse let you use two tools : a template, which defines things like headers, comments, etc when you create new files, and a formatter, which format your file when you save it or explicitely when you ask for a format. I think you have the same approach with IDEA) Thanks Daniel! -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com
