Thursday, July 30, 2009

Fault oblivious software

When faults occur in software they are in nature unanticipated, even though we may know that they will occur. The prevailing paradigm for such is currently, throw the exception. I call that the Pilate syndrome, where the developer washes his hands of the error. This behavior leads the crashes because unhandled i.e. unanticipated exceptions leads to that.

Dont throw exceptions. Now here I am going to violate a lot of correctness principles, because when I advocate for not throwing exceptions, then what should be done? Well nothing. If you try to open a nonexisting file, well you get an file object. When you try to read from it you get a default character, when you read its length you get zero.

All modules that behaves oblivious to faults, will not crash. What happens when faults occur then? The software will be missing in functionality (i.e. something does not work). The result is the same as if it crashed, that the function didnt work. But since the software didnt crash it might act reasonably anyway.

It takes more work to write your libraries to encapsulate faults like this. For debugging purposes a log will suffice, so where you would usually throw your exception, just make a log entry. If the log is an interface, you can if you like display a dialogbox, and halt the program afterwards if you really want to simulate the crash.

Thursday, July 2, 2009

Excuses, Excuses...

I forgot (as I always do), how much I loathe a lot of standard libraries.

This time round, java got the better of me.

I am converting the BNFT tool from C++ (where I spent years creating libraries circumventing the standard libraries follies), but start again fighting with the java library.

I could name a hundred examples, but to some extent all of this also has to do with personal preferences. However, I hope to demonstrate my point with Dawn, if I ever get that BNFT tool working, so I can start some real work. Having been working in C# the last couple of months, shows me why some people prefer it over java. I have been cursing over it, but not to the extent of this experience. C# is not an option though, since I want to target the JVM for cross platform support (and MS/Windows specific source/executables are not really cool).

Ah, it helped to vent at bit, but I would hope that I can get done soon with it.

Labels: ,