>> besides all that said above, as a person who works on more than one >> sub-project of ApacheDS I wish to spare some pain for my eyes and fingers >> everyday while switching between source files in the editor. For me I have separate workspace for project using different coding style with the style profile set in IDE, so I don’t have to switch. Even I need it’s pretty easy to switch between the style profiles.
I’m sorry about the inconvenience. It would be great if we could make it also easy and comfortable for new contributors. It’s critical for the new project not only because we need continuously more effort but also regarding developing of the community as Emmanuel told when considering to promote it as a TLP in future. Regards, Kai From: Kiran Ayyagari [mailto:[email protected]] Sent: Tuesday, January 13, 2015 5:30 PM To: Apache Directory Developers List Subject: Re: [kerby/haox] Dependencies updates needed On Tue, Jan 13, 2015 at 5:17 PM, Emmanuel Lécharny <[email protected]<mailto:[email protected]>> wrote: Le 13/01/15 09:30, Kiran Ayyagari a écrit : > On Tue, Jan 13, 2015 at 4:01 PM, Zheng, Kai > <[email protected]<mailto:[email protected]>> wrote: > >>>> I don't like 4 spaces for XML files, it's quickly too wide, I use 2 >> spaces. >> Agree, let's follow this. >> >>>> Regarding teh Java code, I suggest we keep what you have (likely Java >> code convention), we can vote later on keep it or moving globally to >> another convention. >> I do like the current one that can be most easily setup in IDEA or Eclipse >> in my view and is also very concise/compact in lines, but sure I would >> follow the best practice if we vote one. The major concern would be we have >> to find/write a tool to convert the existing codes to use the new style if >> we have to change. >> >> Current codes follow in the following style I copied from IDEA template. >> === >> public class Foo { >> public int[] X = new int[]{1, 3, 5 7, 9, 11}; >> >> public void foo(boolean a, int x, int y, int z) { >> label1: >> do { >> try { >> if (x > 0) { >> int someVariable = a ? x : y; >> int anotherVariable = a ? x : y; >> } else if (x < 0) { >> int someVariable = (y + z); >> someVariable = x = x + y; >> } else { >> label2: >> for (int i = 0; i < 5; i++) doSomething(i); >> > the above block certainly hurts my eyes ;) I can understand. But let's not be religious about that... definitely not :) In any case, even if we keep the Java standard code format, there are things that must change for rational reasons : 1) int someVariable = a ? x : y; Barely readable. And it's just about using simple variables here, but when it comes to complex expressions, the ? and : will be totally invisible. Better write : if ( a ) { int someVariable = x; } else { int someVariable = y; } Way more readable. 2) someVariable = x = x + y; Yuk. Everytime I see such construct, I vomit. Again, this is an almost guarantee to fuck up big time. Every expression when a normal human being have to *think* to understand what the code is doing is a nail in the coffin of what computer science is made for : spare a human being the pain to think. 3) for (int i = 0; i < 5; i++) doSomething(i); Any construction where a loop is done without { and } to enclose the expression to execute is dangerous. At first, you do something like : for (int i = 0; i < 5; i++); then you decide to do something and change the code to be : for (int i = 0; i < 5; i++); doSomething(i); Now, you are totally fuxked, and it may takes hour to understand why. *Every* single expression must be enclosed into { and }. besides all that said above, as a person who works on more than one sub-project of ApacheDS I wish to spare some pain for my eyes and fingers everyday while switching between source files in the editor. Otherwise, I don't mind if we decide to use Java coding convention. I prefer the Directory coding convention, because I'm under no obligation to work on a VT-100 since 1985, so with my 1680x1050 display, with 50 lines/200 char per line screen (and it's a laptop, I'm not mentionning those who use a 30" screen here...), and even when using Monaco 11 fonts - and being 50 years old, with difficulties to read small font, it tells something ;-), I have no problem with spaced code. -- Kiran Ayyagari http://keydap.com
