Lessons Learned

June 5th, 2007

It’s only Tuesday afternoon, and already this week I’ve learned a great deal about producing better software, albeit inadvertently - nothing teaches you more about code than having to fix stupid mistake. Each week I always learn some new insight but this week it’s been like a waterfall of learning the hard way. I thought I’d moan at you lot, because it’s more fun than whining about it all inside my own head. :-)

  • Users are lazier than you think - to me, it’s pretty obvious that if I’ve already entered data into a system, I’m not going to enter it all over again, but this time full of typos and changing reference numbers around. I’m just going to enter the data in correctly first time, and if I have a problem, I’ll go back and edit it. Not so users of one system I’ve been working on this week. Cue an afternoon of going through data and checking it for consistency errors
  • Users don’t read the screen - we noticed a load of weird consistencies elsewhere in the same system. It turns out that I’d upgraded ferret on the system, and then the ferret index on the app was obviously foo-barred (note: when doing a gem update on ferret you MUST either clear out the index dir in your Rails app or you must script/console and Model.rebuildindex on each Model you’ve got actsas_ferret rolling with - you don’t have a choice in the matter). Strangely, in the period the app was doing this, people must have been putting data in and getting the “Application error” screen. Did they stop? Not likely - they just carried on, hoping it wouldn’t matter. Cue another half an afternoon of checking the database for errors.
  • Logs are more useful than you think - Rails logs all parameters it gets, even in production mode. Some people think this is a security risk, and for password forms you should definitely turn it off (look up filterparameterlogging to see how). However, when you have a load of weird consistency errors in your DB, my god do those logs help reconstruct what was going on and help you fix what happened
  • script/console doesn’t do what it says it just did - try this: take a model with a datetime column. In script/console, try and assign a new date to a record and save it. Note how that didn’t work. I’m not quite at the bottom of why, but it’s curious that it doesn’t “just work” - it may be a config issue, but I can’t see what right now.
  • Nobody cares about my problems, they’ve got their own - I don’t even know I bother bitching about this stuff: I just find myself shouting into a big empty echo chamber that is the Web. :-)

Anyway, I’m at a careers fair tomorrow helping out MDDA up in Cheetham Hill. I hope to return with all my limbs intact.

After that, I’ve got tickets for all five days of the cricket at Old Trafford, so I’ll be pretty much in holiday mode after tomorrow.