Changes between Version 3 and Version 4 of DolphinCodeConvention


Ignore:
Timestamp:
Aug 24, 2010, 6:47:04 AM (14 years ago)
Author:
Andrew Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DolphinCodeConvention

    v3 v4  
    3838 
    3939                         
    40 3. Function Declaration: Names and Formatting 
     40== Function Declaration: Names and Formatting == 
    4141All Function Names should start with a lower case letter, and each word should begin with a capital letter. Curly braces used in the list of parameters must be given on a new line instead of following the brackets. 
    42 Example: 
    43                         function myFunction($iNumber, $sName) 
     42 
     43'''Example:''' 
     44 
     45         
     46{{{ 
     47                function myFunction($iNumber, $sName) 
    4448                        {  
    4549                                //code here 
    4650                        } 
     51}}} 
     52 
    4753                         
    48 4. Language Structures Formatting 
     54== Language Structures Formatting == 
    4955Language structures such as if ... else, for, foreach, while, etc. must be presented in the following manner: 
    50 To provide better readability of the code, there should be a space between the name of the structure and the following parenthesis 
    51 For the same reason, statements concluded within the brackets should be separated with a break 
    52 A similar rule applies to ternary operator 
    53 There is no space after the left parenthesis and before the right parenthesis 
    54 Curly braces must be on new lines 
    55 Example: 
     56 
     57- To provide better readability of the code, there should be a space between the name of the structure and the following parenthesis 
     58- For the same reason, statements concluded within the brackets should be separated with a break 
     59- A similar rule applies to ternary operator 
     60- There is no space after the left parenthesis and before the right parenthesis 
     61- Curly braces must be on new lines 
     62 
     63'''Example:''' 
     64 
     65 
     66{{{ 
    5667                        foreach ($aNames as $sKey => $sVal) 
    5768                        {  
    5869                                //code here 
    5970                        } 
     71}}} 
     72 
    6073                         
    61 switch construction 
    62 The above rules must be applied for the switch construction itself. The inner case-statements should be indented with the tab. The inner case code should also be distinguished with an additional tab. The closing break must be placed on the new line and aligned with the case. 
     74'''switch''' construction 
    6375 
    64 Example: 
    65                         switch ($iNumber) 
     76- The above rules must be applied for the switch construction itself.  
     77- The inner case-statements should be indented with the tab.  
     78- The inner case code should also be distinguished with an additional tab.  
     79- The closing break must be placed on the new line and aligned with the case. 
     80 
     81'''Example:''' 
     82 
     83                 
     84{{{ 
     85        switch ($iNumber) 
    6686                        {  
    6787                                case 1: //code here break; 
     
    7292                                        //code here 
    7393                        } 
     94}}} 
     95 
    7496                         
    75 5. Writing Your Own Code 
     97== Writing Your Own Code == 
    7698When writing your own code to modify the original script, it must be thoroughly commented to be easily distinguished from the original code. 
    7799 
    78 Example: 
     100'''Example:''' 
     101 
     102 
     103{{{ 
    79104                        //Extension Name. Author name.// 
    80105                        SomeCodeHere(); 
    81106                        //[END] Extension Name// 
     107}}} 
     108 
    82109                         
    83 It's highly recommended to leave most of the original script untouched when modifying the code. All the functionality of the extension must be saved in separated files instead of the original code. The files with functionality of the modified product must be combined in a separate folder appropriately named (extension name). Each folder should follow a system of docs i.e. cataloging to keep all pictures in the folder "images", stylesheets - in "css" folder, etc. 
    84 6. Database Tables 
    85 Tables used in the extensions must be named with the prefix (extension name). For example, MyModName_Users, MyModName_Passwords, etc. 
     110It's highly recommended to '''leave the original script untouched''' when modifying the code. All the functionality of the extension must be saved in separate files instead of the original code. The files with functionality of the modified product must be combined into a separate folder appropriately named (extension name). Each folder should follow a system of docs i.e. cataloging to keep all pictures in the folder "images", stylesheets - in "css" folder, etc. 
     111 
     112== Database Tables == 
     113Tables used in the extensions must be named with the prefix (extension name).  
     114 
     115'''Example''' 
     116 
     117 MyModName_Users, MyModName_Passwords, etc. 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.
Fork me on GitHub