Wednesday, August 27, 2008

Soft exceptions

Something that I would like to consider for the future is an idea I call soft exceptions. They are probably industry standard already and I'm just the last to know, but here's the idea.

Many times I want to execute a block of code which does something, but not something important. If I'm writing some important piece of software, I don't want problems in unimportant code areas bubbling up to cause big problems in areas that *are* important. This can be managed by writing great code, having an entire bureacracy of test scripts and good defensive coding habits. Or you can just wrap the whole lot in a try statement and best practises be be blowed.

I've got this idea that there can be a middle ground -- a way of being able to protect your important code when it's live and being relied upon (other than by just not having errors happen) while not putting in kludge after kludge to keep the motor running.

The idea is, basically, that exception handling would be linked to the logging system, and that whether an exception was fatal or not would depend on the logging/debug level set.

For example, I might have a code loop which is something like the following:


except KnownFailureMode:
print "Sorry, there is no wheat in the hopper"
log("Something not very important broke unexpectedly")

if logLevel = "soft":
log('soft exceptions, see traceback')

This code would
a) Protect the important code in the loop
b) Respond to known failure modes
c) Log everything
d) Re-raise unexcpected exceptions if in debug mode
e) Suppress unimportant things if in operational/critical mode

I could even imagine "fallback mode' operations which could be user-enabled which would enable hard exception handling....

Just some thoughts....

Friday, August 15, 2008

Melbourne-based Javascript experts

Hi lazyweb,

I was wondering if there are any Melbourne-based javascript experts who would be able to help me with a bit of learning. I could really benefit from being able to pick someone's brain for a few hours, with problems in front of me etc. I don't want a training course, just a kind of expert tutor for some assistance. I'd be happy to pay a fair hourly rate for the time spent of course. Google a.k.a. the Internets didn't really have any obvious promising leads, so I'm hoping this might find its way into the inbox of a real person who could help me out. God speed, message in a bottle!

Email me at