June 17, 2007
Haphazard would be the best word to describe my web development abilities when I started out a little over a year and a half ago. My code was disorganized and poorly named. I had barely even heard of usability. I was uploading every small change during development to my shared server. I could go on and on. The point is that had no idea HOW to properly develop a web site even though I had become fairly comfortable with the programming languages I was using. By all means, I’m still not an expert in web development, but the following is what I’ve learned so far on coding smarter, streamlining your workflow, and increasing usability.
- Structure database columns with descriptive ENUM values. Using True and False or Yes and No can quickly become confusing. Instead try using values such as Accepted and Denied or New and Deleted.
- Name your functions and classes to serve as your comments. Instead of naming a function “get_post” which is ambiguous, you could call it “findNewestPost”, “findUsersPosts”, “findAllPosts”, or “findAllPostsInLastTenDays.” The last example is a little long winded, but I tend to err on the side of length if it makes my code more readable.
- Give your loop count variables specific names. Using “$i” or “$j” can become very confusing especially when you are working with nested loops. Instead, use variable names such as “pageCount” or “userCount.”
- Organize your functions. Try sorting by functionality such as inserting, deleting, updating, selecting or alphabetically. Whatever you choose, just keep it consistent across your entire project.
- Adhere to a coding standard. A couple of choices are PEAR Standard and Zend Standard . If you can’t find one you like, draw up your own!
- Use a framework. Find one you understand and learn it or build your own. It’s pretty amazing how much time and effort these gems can save you in the long run. My PHP framework of choice is CodeIgniter.
Streamlining Your Workflow
- Keep manuals and resources open. Inevitably you’re going to get stuck. What does that CSS property do again? Why isn’t this PHP function returning what I want it to? Save time by keeping your resources ready at hand.
- Code and test on local server. Don’t waste time uploading every small change to a remote server. Take the time to set up a web server on your computer in the beginning and save yourself the frustrations of developing remotely.
- Find a good text editor. My editor of choice is TextMate which allows me to edit HTML, CSS, and PHP with ease. You might also want to check out Coda, which is billed as “one window web development” to streamline your workflow even further.
- Limit features. How could leaving out new and innovative features actually increase usability? Here’s why. Besides the point that every feature you add your program gets fatter[ie hard to maintain], too many features can confuse your customers. Keep it simple stupid.
- Label for your customers, not you. Take a seat in your target market’s chair and draw up your navigation, actions, etc. so that they will be easily understood. You may very well know what XYZ does, but does your mom? This goes for bloggers too.
- Limit options. This one’s important. For example, one of Echonote’s abilities is to give users suggestions on who they should invite to the site. I could’ve easily given the user a bunch of options such as to include friends of friends, people in the same group people that were sent the same message, etc. If you’re confused, good. That’ is exactly how Echonote’s visitors would feel. Instead, I came up with what I thought was the best mix of the various factors and provided a default suggestion amount. I then simply gave the user the option to increase or decrease the amount of invite suggestions.
Again, the list above is not intended to be a complete, but rather various tidbits I’ve gathered along the way. Many of them I learned from reading the following books and I highly recommend them to anyone who’s currently making their way into web development.