Preventing Errors in Code
This week looking at preventing errors when coding:
An ounce of prevention
If you don't read anything else, read the Joel Test to make sure your development practices follow the basics. If you can't pass the test there's your todo list, Joel Spolsky wrote it over a dozen years ago and still just as valid today.
Pete Warden writes an observant counter argument against open-offices, Writing code is not most programmers primary task which is worth a read. I include it as a reminder, many errors occur by not asking questions and understanding the goal of what you're doing. No number of unit tests will fix misunderstood problems.
Be consistent, use a checklist. If you find yourself repeating a complex process look at creating a checklist to help your memory. Pilots and doctors are doing it why not your iPhone app deployment. I saw Matthew Eppelsheimer give a good flash talk on using checklists at WordCamp Portland.
Why? Why? Why? Why? Why? The five why methodology is used to discover the root cause analysis and not just fix the current problem, but prevent it from ever happening again. Eric Ries wrote a good article about Five Whys for Start-Ups or if you prefer a bit older look at the methodology:
For want of a nail a shoe was lost,
for want of a shoe a horse was lost,
for want of a horse a rider was lost,
for want of a rider an army was lost,
for want of an army a battle was lost,
for want of a battle the war was lost,
for want of the war the kingdom was lost,
and all for the want of a little horseshoe nail.
In case of emergency
Accidents do happen and downtimes occur, don't hide but be up front and honest with your users. Communicate the results, Google and Amazon have dashboards for their service outages why should you be embarrassed. Create your own check out open source project System Status Dashboard or maybe the hosted SaaS solution if your site is down, your alert system might be too.
Bits & Bytes
- Selenium is the best functional testing framework for web applications. You can see my selenium example using python but better yet read up on Sauce Labs hosted selenium testing.
- Tarek Ziade has a tool aptly named Boom! which is a command-line tool to generate load against a website, intended as a replacement for Apache Benchmark.
- If using a local server to generate load is a bit pedestrian, you can always turn to the cloud, with a service like LoadStorm you can summon a 50,000 user Typhoon (name of the service level) and descend it against your website.