Changes between Version 1 and Version 2 of Documentation/DevelopingForXinha/StyleGuide


Ignore:
Timestamp:
11/18/08 10:05:21 (11 years ago)
Author:
ray
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/DevelopingForXinha/StyleGuide

    v1 v2  
    44This page is meant to provide some basic coding practices and style guidelines for developers working on Xinha. 
    55 
    6 1. '''Don't use tabs.''' Instead, indent code blocks with '''two spaces'''. 
     61. Put the brace associated with a control statement on the next line, indented to the same level as the control statement. Statements within the braces are indented to the next level. [http://en.wikipedia.org/wiki/Indent_style#Allman_style_.28bsd_in_Emacs.29 (Allman Indent Style)] 
    77 
    8 2. Always use semicolons after curly brackets (see #1326). E.g.,  
     82. '''Don't use tabs.''' Instead, indent code blocks with '''two spaces'''. 
     9 
     103. Always use semicolons after single lines, function definition and object literals, but not after loops and if-blocks. E.g.,  
    911{{{ 
    10 var foo = function() { 
    11   alert('foo'); 
     12var foo = function()  
     13{ 
     14  alert('foo');   
     15  var foo =  
     16  { 
     17    foo1 : 'bar1', 
     18    foo2 : 'bar2' 
     19  }; 
     20  var bar =  
     21  [ 
     22    'foo', 
     23    'bar' 
     24  ]; 
     25  for (var i=0;i<10;i++) 
     26  { 
     27    //... 
     28  } 
     29  if (foo == bar) 
     30  { 
     31    //.. 
     32  } 
    1233}; 
    1334}}} 
    1435 
    15 3. Always use {{{var}}} when declaring variables, unless you ''really'' do mean to create a global variable. 
     364. Always use {{{var}}} when declaring variables, unless you ''really'' do mean to create a global variable.