Java Coding Conventions
I will now right the same self-righteous diatriabe about Java coding conventions that every other coder on Earth has written.
These are specific to Java, I firmly believe in modifying my coding style to fit a language.
Step 1: Class Naming
I just saw an java class named Active_object. I’m not even kidding. It was like being stabbed in the eyes. Underscores do not belong in Java. It’s that simple.
Secondly, it wasn’t even Active_Object. Proper naming: ActiveObject.
Step 2: Braces
Everyone has their braces style. Stricly speaking I should be using the Java convention, but I hate the java convention. I can never find the opening brace, so I do this:
public void method()
{
System.out.println("Donkey");
}
never do I do this:
public void method() {
System.out.println("Donkey");
}
because to me, it looks so ugly. Ugh. Of course I’m scarred by 2 years of working in the deepest inner bowels of an interpreter written for a functional programming language written in C. *shivers*
Step 3: Variable Naming
Variable names are not places in which to store metadata. Examples: mField, bConnected. Ow.
The “no underscores” argument applies here as well. properlyNamedVariable not improperly_named_variable.
Step 4: Conclusion
“Coding styles are like !#*holes, everybody has one, but nobody wants to touch anybody elses.”
I hope “System.out.println(”Donkey”);” is tabbed, now is that soft tab or a hard tab? ;-)
Posted on 27-Oct-07 at 11:33 am | Permalink
It’s SPACES. :D
Dude, I just CTRL-A, CTRL-I in eclipse all the time. I don’t know or care what the tabs and spaces are. :D
Posted on 27-Oct-07 at 11:35 am | Permalink