Good coding practices I use

- Write flexible code that can be changed and extended, changes in underlying technologies shouldn't ripple through the whole system
- Code should be maintainability – long shelf life
- Layers should not be tightly coupled. Each layer needs to be independent from the other. Use interfaces, dependency injection etc
- Indent all files using spaces (Indent once = 4 spaces)
- If you are using an IDE, use the formatter and tools that comes with it to organize and clean up your code
- Comment your code often. Use Javadoc standards.
- Use sensible naming conventions for variable, method and class names.
- Use exceptions only if required. Do not use exceptions to handle errors. If errors occur we want the message to propagated up the call stack.
- Do not use scriplets in your JSP code. Use JSTL Expression Languages where required.
- All jsp file names should be in lowercase
- All text in JSP's should either come from Database or Resource bundles. No text should be hard coded in HTML
- HTML pages should be XHTML Transitional
- Validate your HTML pages using w3c validators
- All styles should be written in css. No HTML style attributes
- If your code causes warnings or errors in other code, fix other code as well. There shouldn't be any code in CVS which has errors or warnings.
No comments:
Post a Comment