Friday 28 September 2007

A confession from the boss

We have a system where jobs have a status (active, inactive etc), which is stored in a field. There is also a list for each status containing the IDs of all the jobs matching that status.

When the status of a job is changed, a form-handling script updates the status of that job, and modifies the status lists. IF Andy writes code that does approximately the following things in roughly the following order:

* first check the status field of every job and update the status lists accordingly
* then write the new status of this job into the status field

which ahem, kind of doesn't work. Forget 'kind of', it's just flawed code and flawed thinking that causes other people problems in getting their work done, their timesheets entered, their tea made.

SO now the form handler does this instead:

* first write the status of this job into the status field
* then check the status field of every job and update the status lists accordingly

This is an example where, by trying to write a script that would be more robust (check all kubes and update everything JUST IN CASE), we end up with more errrrors than if I'd just followed the apparently sketchier route of appending the job to one status list and removing it from another. Hey ho.

No comments: