Tuesday, January 17, 2006


Missing-Method Exception Handling in Dynamic Object-Oriented Systems


Can Good Congruence Processing Work Outside of an Intelligent Mind?

It's funny. You're talking with someone and they throw things out at you, and you've never heard about what they're saying, but it all starts to seem like something else you have experience with. It fits into familiar patterns - it seems close to something you know about - it is congruent to a known. As you consider everything more closely, you think about it within the familiar context. You're able to make conjectures and draw conclusions. Though they might be right or wrong, your brain didn't crash when it encountered the unknown - like most software would. It dynamically came up with a way to recover.

In a statically-compiled object-oriented system, a target object's methods are called by other objects. The target usually responds to the method by doing some work, possibly changing its state or calling methods on other objects, and then possibly returning a value. If the method being called doesn't exist in the target, this is caught by the compiler and an error is signalled. Typically, an executable program will not be generated until this problem has been corrected. The system is relatively brittle, with little room for processing the unknown.

In a dynamic object-oriented system, any method can be called on any object - a much less brittle mechanism. The fun starts when the method being called on a target object doesn't exist and a runtime exception is raised that the program can try to handle and recover from. This missing-method exception handling can do whatever it needs to do to try to take corrective action, or fail in trying and stop the processing of the method, or perhaps halt the entire program.

While it is simplistic to equate the brain's forgiving wetware processing with the step-by-step execution of a dynamic program on silicon, perhaps a parallel to the missing-method exception can be drawn between them. The brain seems to try to integrate the questionable through congruence and analogy, recovering from missing information by trying to transform it into something known. This seems to be able to happen at many levels at once. Of course, if a fit can't be found you might get a "What the heck are you talking about?" (or its equivalent). But experienced, intelligent minds tend to be very fluid, able to map unknowns onto knowns with ease, even with only a partial fit. And thinking continues.

Pulling back to dynamic object-oriented systems, when a missing-method exception occurs, can something similar be done? Is it possible to use congruence to build good recovery into these systems with just a small amount of programming, and still get reasonable results? How can congruence mapping be done to help recover from a missing-method exception? What clues can be added to a system that could be used to form congruences? How can the the system determine that a congruence doesn't fit well enough and it's time to try another, or just give up?

I don't know... yet. But I'm thinking congruently about it.

No comments: