Archive

Posts Tagged ‘Coding standards’

Google Moderator on Coding Style Preferences

April 10th, 2009

I’ve just started a Google Moderator on Coding styles. The idea is to find which coding style preferences are accepted by the majority, which interest nobody and which are balanced between likers and haters.
spaghetti2lq9

Google Moderator is not the perfect platform for this kind of experiment (no code formatting, no urls…) but I wanted to give it a try.

Feel free to add a lot more questions.

Blog , ,

More on coding standards

December 31st, 2004

After I wrote a teaser on coding standard, I found this article saying that Style is symmetry and structure! I’ve allways felt that Sun’s standard was hurting my poor brain but I couldn’t say why. Now, thanks to this article, I know why. Symmetry ! Read more…

Blog

Coding standards

December 30th, 2004

Each developer has its own view on coding standards. What about you ?

Do you prefer this syntax :

JAVA:
  1. int arrayIndex = 1 ;
  2. boolean isOk = true ;
  3.  
  4. if (isOk)
  5. {
  6.     doSomething() ;
  7. }
  8. else if (1 == arrayIndex)
  9. {
  10.     doSomethingElse() ;
  11. }
  12.  
  13. public static boolean contains (int[] anArray, int aValue)
  14. {
  15.     for (int i = anArray.length - 1; i>= 0; i--)
  16.     {
  17.         if (anArray [i] == aValue)
  18.         {
  19.             return true ;
  20.         }
  21.     }
  22.     return false ;
  23. }

or this one :

JAVA:
  1. int array_index=1;
  2. boolean isOk;
  3. isOk=true;
  4. if (isOk == true) {
  5.   do_something();
  6. } else if (array_index==1) {
  7.   do_something_else();
  8. }
  9.  
  10. public
  11. static
  12. boolean
  13. contains (int[] array, int value) {
  14.   boolean found;
  15.   for (int i=anArray.length-1; i>=0; --i) {
  16.     if (aValue==anArray [i]) {
  17.       found=true;
  18.       break;
  19.     }
  20.   return found ;
  21. }

I've been using the former for a long time now (on JAVA and C/C++) and I couldn't change my habits so easily.

Blog