August 2010 Archives

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.

 
 
 

  1. use comments so others can understand what you are doing
  2. do not use any Dreamweaver generated code as your example (in most cases, do the opposite)
  3. use a JavaScript framework (my favorite is MooTools), no need to re-invent the wheel for things like ajax
  4. try and stick to one framework instead of mixing MooTool and jQuery
  5. don’t make functions with a million arguments, just pass a single array for readability and flexibility (think MooTools style)
  6. use tabs not spaces
  7. use all lowercase filenames and directories
  8. even worse, don’t name files in one case and code them in a different (ever heard of a case sensitive filesystem?)
  9. use associative arrays where it makes sense, such as multi dimensional arrays and objects (see this post)
  10. honestly, who uses Spry anymore?
  11. CSS hacks and IE conditionals are cool and all, but learning to code CSS better will almost eliminate any hacks you’ll need
  12. keep admin and front end code separated except for shared functions
  13. test in all the browsers you need to support
  14. 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)
  15. avoid flash for things like menus that can easily be accomplished using HTML and CSS
  16. avoid inline JavaScript and instead use an external file to keep the HTML clean and maintainable
  17. don’t use inline CSS either
  18. make sure to secure your ajax pages, don’t want anyone messing with your database
  19. keep mobile platforms in mind when thinking about usability
  20. 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.