When I code things myself and especially when working with code that other’s have written, here are things I always think to myself.
Just a few friendly tips to keep in mind for your next project. These are in no particular order, just as I thought of them.
- use comments so others can understand what you are doing
- do not use any Dreamweaver generated code as your example (in most cases, do the opposite)
- use a JavaScript framework (my favorite is MooTools), no need to re-invent the wheel for things like ajax
- try and stick to one framework instead of mixing MooTool and jQuery
- don’t make functions with a million arguments, just pass a single array for readability and flexibility (think MooTools style)
- use tabs not spaces
- use all lowercase filenames and directories
- even worse, don’t name files in one case and code them in a different (ever heard of a case sensitive filesystem?)
- use associative arrays where it makes sense, such as multi dimensional arrays and objects (see this post)
- honestly, who uses Spry anymore?
- CSS hacks and IE conditionals are cool and all, but learning to code CSS better will almost eliminate any hacks you’ll need
- keep admin and front end code separated except for shared functions
- test in all the browsers you need to support
- code for standard compliance first, then fix as needed for Internet Explorer (see #11, in most cases IE will work well if you code well)
- avoid flash for things like menus that can easily be accomplished using HTML and CSS
- avoid inline JavaScript and instead use an external file to keep the HTML clean and maintainable
- don’t use inline CSS either
- make sure to secure your ajax pages, don’t want anyone messing with your database
- keep mobile platforms in mind when thinking about usability
- public pages should function in IE6, but I’m not too concerned about them looking good
Well, those are 20 things I just thought of. I’m sure I’ll think of more and when I do there will be the inevitable part 2 post.
















Rule #9 – FYI, JavaScript doesn’t have “associative arrays”.
Other than that, this is a good set of rules! Thx