Displaying items by tag: web development
- Establish naming conventions. Do not assume you'll always be the one coding for a particular site. Never use generic names for classes, IDs and form names in your code like “comment” or “article”. Someone else may do so too, so you can kiss your app’s functionality bye-bye!
- Avoid inline CSS like the plague.
- Try to squeeze as much CSS code as possible into one file. Less CSS files means faster loading of your site's design on the browser.
- Avoid placing UI images inside your HTML code. UI images belong to given UI templates (home, category lists, product catalog, article etc.) and therefore are loaded on every page request. Placing such images as "background images" in your CSS file allows the browser to cache them the first time it renders them, which means your site will load faster on subsequent requests for your visitors.
- Avoid inline JavaScript. Use CSS IDs or classes to attache JavaScript behaviour where necessary.
- Try to squeeze as much JavaScript code as possible into one file
- Don’t execute JavaScript code when not needed! E.g. if you apply behaviour to a certain block of code and this block of code does not exist on all your pages, make sure you check if this block of code exists by using a simple check for the block's container ID or class. You can do that pretty easily with jQuery or Mootools these days.
- Avoid inline CSS inside your JavaScript code. Stick to classes and IDs. Don’t inject too much HTML markup if possible. Try to alter the behaviour of your app by adding/removing CSS classes/IDs. Avoid hardcoded language strings inside JS code if you plan to make your site multilingual in the near future.
- If you code on PHP, check out the Tidy library. Enable it when you can as it will easily point out (and fix) bad markup in your HTML.
- For God’s sake use an open source CMS, don’t re-invent the wheel, make it possible to contribute back. Joomla, Drupal, Wordpress are enterprise class CMSs to get started with and some of the most popular websites in the world are powered by these open source CMSs.