How about some standardized standards for code style? :)

by Dion Almaer

As I was going through setting up my IDEs on my new Apple PowerBook (yeah, I love OS X now too), I thought that it could be kinda cool if we had standards for code style. At the moment I can say things like "I want the { on the same line for if statements", but wouldn't it be nice to say "I want the Sun Java Coding standards", and boom have my code conform. This would allow us developers as individuals, to look at code the way WE happen to like to look at it.


We could even get fancy as say things like "I want the 'Bob Martin' style where instance variables are my, class scoped are their, ...". We could even create a DB of code conventions where people could categorize, and rant about the various ideas out there.... not that we get religious about these kinds of things ;)


Eric Burke is talking about how he doesn't like "this" anymore


7 Comments

anonymous2
2003-07-21 14:25:49
do some research
IDEA (from Intellij) has savable coding standards that you can apply very easily. Sun's is one of them.
dion
2003-07-21 14:35:56
specific IDEs have it... but what about sharing?
I know that some (quality) IDEs do have support like this. I am just thinking outloud about how it could be cool if these "standards" were standard.
anonymous2
2003-07-21 15:35:47
You mean like this
http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
anonymous2
2003-07-22 06:39:27
Start here: http://jalopy.sourceforge.net/
jwenting
2003-08-08 04:50:25
specific IDEs have it... but what about sharing?
The problem with all these "standards" is that they aren't.


I've worked for many different customers as a consultant, and each had his own "standards".
Often different projects within a company will adopt different "standards" even.


Your idea of an editor forcing a specific coding style on the programmer is to me (and I am sure many others) horrific.
Standards are there as guidelines, or should be, not as strict patterns that have to be used without thinking
I've worked in projects that were like that. Everything was dictated down to the exact character location of every line and item in the header comments.
Function names were so strictly regulated that it was almost silly.


Did it make the code easier to read? no.
Did it make it easier to find things in existing code? yes, mainly because everything was so predictable.
Did it make for faster programming? Certainly not.


there have to be standards, but they have to be sensible. How strict those standards are applied will have to depend on the size of the project.
What they are should depend on the people in the project (what are their experiences, what can they adapt to and live with, what are their preferences).

ned___flanders
2003-08-10 05:11:48
Maven can...
I don't know if you have heared about Maven (http://maven.apache.org), but the built in checkstyle plugin can be configured to pre-defined code standards such as Sun, Avalon or Turbine. One of that standards might fit your needs.
anonymous2
2003-11-07 07:35:37
Start here: http://jalopy.sourceforge.net/
I like Jindent: http://www.jindent.com