Re: [OJB-developers] various questions
Brought to you by:
thma
From: Chris G. <CGr...@de...> - 2002-04-28 17:12:33
|
> > That's a nice idea. I think the simplest way to start such a discussion > to start with someones first draft proposal. Others might comment on > this draft. > > Any volunteers? Sure. :) I'll just throw out the ones I'm most familiar with to get things started. 1. Non-static member variables. a. References prefixed with "this.". b. First letter lowercase, beginnings of subsequent words capitalized. private int Anint = 0; public void increment() { Anint++; } would become private int anInt = 0; public void increment() { this.anInt++; } 2. Static member variables. a. All uppercase. b. Underscores ("_") used to separate words. So private static int aStaticInt = 50; would become private static int A_STATIC_INT = 50; 3. Method names (static and non-static). a. First letter lowercase, beginnings of subsequent words capitalized. So public static int GetInt() { return 5; } would become public static int getInt() { return 5; } 4. Braces around blocks of code. a. Opening brace on the end of the line starting the block. b. Closing braces aligned with the beginning of the line starting the block. So if (true) { doThis(); } would become if (true) { doThis(); } 5. Method / member organization. a. Member variables declared before methods. b. Static members declared before non-static members. c. Static method declared before non-static methods. d. Private members declared before protected members. e. Protected members declared before protected members. f. Public members declared after all others. g. Same precedence for methods. 6. Test class naming. a. All JUnit test classes should be named "xxxTest". So public class TestOfClassA extends TestCase { } would become public class ClassATest extends TestCase { } And that's what I can think of off the top of my head. Have at it. :) Cheers, Chris |