Web Development/Good coding procedures and adherence to standards< Web Development
Once you have chosen an appropriate language (see 5.3: Choosing the right programming language), it is important to code your website well. Cleanliness is both important and respected among programmers, and an effective, efficient algorithm will be appreciated by the end users.
You should plan the logical layout of your website code beforehand, with the methods, objects, etc., and their purposes clearly defined and related. Be precise with this pre-planning. Draw it on a napkin, type it out, do whatever you have to to get a concrete understanding of your backend's structure beforehand. This will come in handy. Oftentimes, programmers say that planning is the most important stage of programming (that and bug-testing).
Aside from planning ahead, here are some other general guidelines:
- Keep an online manual for your language open at the same time you're coding, in case you need to look up an obscure function or precise syntax.
- Be sure to never use outdated algorithms or tags. Tags like <marquee> and <font> are no longer standard HTML tags. Syntax for languages is always being updated. Make sure you're coding in the most recent version of the language. Backwards and forwards compatibility are important. Don't use code that is already outdated, and if the manual says a function will probably be discarded in a future update, don't use it.
- It's important to comment your code, in case someone else takes over for you at some point. This is also important for when you have to update your code in the future, in case you forget your own logic.
- Make your code abstract, in case the same method needs to be implemented in more than one place.
- Any other general standards for coding well should be used.
In conclusion, plan ahead. It's much better to spend five minutes planning ahead than to spend hours going back through your code because you made a logistical mistake in the very beginning.
Java and JSPEdit
A very good automated tool for enforcing Java coding conventions is checkstyle. This tool is highly configurable.
Use the javadoc tool included in the Java SDK to document your code.
All the tasks above can be integrated using ANT.