Wednesday, April 16, 2008

Another 2:00am wakeup

This happens quite often, these days. I used to sleep through the night. Usually I enjoy doing things in early morning, like 5:00am. 2 isn't good time to wake up. This happens especially I get to sleep with some thoughts. Last night, I was thinking about 'How to generalize test directories'. I collected good number of test cases. My solution is providing default callback handlers, and specific handlers will override if specified. Loading/Unloading/Reloading modules at runtime isn't fun, but better than introspect.
If someone asks 'why is introspect bad?', I don't want to say it is bad. It isn't suitable for callback handler. The code is half open, and the rest half will be provided at runtime. Thanks to duck typing, traceback will byte me way later. With introspect, class name doesn't need to be fixed. I need to grab class name on the fly. But, other than this benefit, whole chain of responsibility comes after that. It is very difficult problem to figure out "Is this the callback handler for event A or B, or is it really a call back handler??" C++ compiler will be useful in this case ;)
If constraining class name by fixing it, I know what I am binding. Much simpler and yeah.. I am lazy.

No comments: