Coding standards

If you are looking to contribute code to Enano, you are always welcome to do so. In an effort to keep code organized, and to maintain compatibility with older servers, there are some basic code syntax and readability standards that we encourage developers to follow.

  • Enano's indentation setting is now hard tabs. We recommend a tab width of 4 on your display; things just line up better that way.
  • When using ifs, loops, functions, classes, etc., all braces should be on a line by themselves.
  • In a switch, indent the case by 1 tab and code underneath it by 2 from the original indentation of the switch statement.
  • Always, ALWAYS check for errors. So what if it takes another dozen lines of code? It is absolutely crucial that the user have a way to report errors to the site administration. If you have to die(), die in a smooth way by ensuring that the error message is passed through to the client and displayed in a clean fashion, with a way to "get out" and go back to the homepage.
  • Always use the database abstraction layer. It has the same exact syntax as the PHP mysql_* functions. See the API documentation for more information.
  • If you're writing documentation, be professional about it. Seriously. We may have some very high-profile users eventually, and we are more likely to have them if Enano is well-documented and written in a professional tone. Remember NSIS? Great installer. Too bad the guy who originally wrote it was a total potty mouth. After the issues were addressed, NSIS started to see much greater attention from high-profile companies.
  • If you volunteer to write official documentation, we recommend possession of excellent skills in English grammar and experience with wiki formatting (it isn't that hard). Experience with editing graphics is recommended as well.
(show page tags)
Categories: (Uncategorized)