Home » Support » Help Articles » Batoi Coding Standards and Conventions

Batoi Coding Standards and Conventions

Back to Help Articles Home


The OSF reinforces correct development paradigm through the OSF IDE and a set of prescribed guidelines for development. Coding standards and conventions do help in this direction. Please find the following list of guidelines as recommendations from us, but you are free to choose you style : )

Server-side Development with PHP

  1. Keep one class one file decorum so that we can use php-doc for technical documentation. For more details about PHPDoc, please refer to the official documentation.
  2. Always use to delimit PHP code, not the shorthand. You can install the OSF and can start testing the first instance of your application in matter of minutes. Moreover, the OSF offers an easy learning curve for a web developer new to it.
  3. Use an indent of 4 spaces, with no tabs.
  4. Control statements should have one space between the control keyword and opening parenthesis, to distinguish them from function calls.
  5. Functions should be called with no spaces between the function name, the opening parenthesis, and the first parameter; spaces between commas and each parameter, and no space between the last parameter, the closing parenthesis, and the semicolon. There should be one space on either side of an equal sign used to assign the return value of a function to a variable.
  6. Function declarations follow the "one true brace" convention. Arguments with default values go at the end of the argument list. Always attempt to return a meaningful value from a function if one is appropriate.
  7. Inline documentation for classes should follow the PHPDoc convention, similar to Javadoc.
  8. Non-documentation comments are strongly encouraged. A general rule of thumb is that if you look at a section of code and think "Wow, I don't want to try and describe that", you need to comment it before you forget how it works.
  9. C style comments (/* */) and standard C++ comments (//) are both fine. No Perl/shell style comments (#) should be used. Comments may be added at the start of the program file, before starting functions, or classes or variables, block of code.
  10. Use example.com, example.org and example.net for all example URLs and email addresses, as per RFC 2606.
  11. Identifier names should be explanatory, and should be in word-case. Also the first letter of the variable or parameter or IDs must tell the nature thereof. Examples (please note carefully) are:
    • Class: ClassName
    • Object: oObjectName
    • Function or method Name: functionName()
    • Constants: CONSTANTNAME
    • String Variable: $sVariableName
    • Array Variable: $aVariableName
    • Integer Variable: $iVariableName
    • Float Variable: $fVariableName
    • Boolean Variable: $bVariableName

Client-side Development with HTML and CSS

  1. Style-sheet must be used for all properties of the HTML elements.
  2. HTML code must be XHTML1.0 strict: http://validator.w3.org/
  3. CSS code must comply with CSS2 standard: http://jigsaw.w3.org/css-validator/
  4. C style comments (/* */) and standard C++ comments (//) are both fine.
  5. ID or NAME attributes should be explanatory, and should be in word-case. Examples (please note carefully) are:
    • CSS Style Class: ClassName
    • HTML ID Attribute: attributeName
    • Form ID: formId
    • Text Box Name/ID: txtFieldName
    • Text Area Name/ID: taFieldName
    • Drop Menu Name/ID: dmFieldName
    • Radio Button Name/ID: rbFieldName
    • Checkbox Name/ID: chkFieldName
    • Button Name/ID: btnFieldName
    • Hidden Field Name: hidFieldName

Client-side Development with JavaScript

  1. C style comments (/* */) and standard C++ comments (//) are both fine.
  2. Identifier names should be explanatory, and should be in word-case. Also the first letter of the variable or parameter or IDs must tell the nature thereof. Examples (please note carefully) are:
    • Object: oObjectName
    • Method Name: functionName()
    • String Variable: sVariableName
    • Array Variable: aVariableName
    • Integer Variable: iVariableName
    • Float Variable: fVariableName
    • Boolean Variable: bVariableName


Updated on Aug 20, 2016

The techReview is an online magazine by Batoi and publishes articles on current trends in technologies across different industry verticals and areas of research. The objective of the online magazine to provide an insight into cutting-edge technologies in their evolution from labs to market.

Visit techReview


English - IN (USD)
New Users? Signup.     Existing Users? Login.