Antwort: Re: [OJB-developers] various questions
Brought to you by:
thma
From: <Joa...@tp...> - 2002-04-29 07:00:04
|
Hy, discussions about braces style often result in flame wars (not big ones, but nevertheless). I'd say Thomas should just say which braces style he prefers and we all use it in OJB, as I don't think a discussion about it will bring any results. I also had exactly the same discussion in my company and it only showed that each style has its advantages and disadvantage, almost everybody knows them and the only difference is the priority the people set on readability, compact codex, ... member access via getters/setters? Even inside the class? I wouldn't do that. Sometimes (very seldom actually) I got some additional logic inside setters that doesn't make sense when used from inside the class. other than that I like the rules (they are like Suns smalles common denominator). only one more thing: there's a typo in 5.e. I think it should read "protected members declared before public members". regards Joachim Sauer "Jakob Braeuchi" An: <cgr...@de...>, <tho...@ho...> <jbraeuchi@ho Kopie: <CGr...@de...>, <Joa...@tp...>, tmail.com> <obj...@li...> Thema: Re: [OJB-developers] various questions 29.04.2002 07:48 hi, 4.) i prefer the following style for braces if (true) { doThis(); } i think it's more readable than if (true) { doThis(); } another issue is member access. instance variable should be accessed using getters and setters . just my 0.02 CHF jakob ----- Original Message ----- From: "Chris Greenlee" <CGr...@de...> To: <tho...@ho...> Cc: <CGr...@de...>; <Joa...@tp...>; <obj...@li...> Sent: Sunday, April 28, 2002 7:12 PM Subject: Re: [OJB-developers] various questions > > > > > 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 > > > > > > > > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > |