I also thought about using the handler. It is not bad but it has no
"can handle" method. So you basically have to try it and check if it
handled the message... I guess that is ok. I can move the iteration
through all handlers into the SafeRunnable and keep trying until I get
one.
The problem now is that IHandlers have state (listeners at minimum)
and some subclasses actually make it explicit and therefore is not
good for multi-threaded programming. We would be tempting
implementers to create stateful Handlers which is a terrible idea for
this application. Also as a parameter you get a ExecutionEvent as the
parameter which has a Map as the parameters so the developer cannot
use code completion easily to see what the parameter will be.
None of these issues kill the idea it just is not a nice API to learn.
Addressing the point we are making developers learn 2 APIs. That is
absolutely true... However the counter argument to that is that they
may not need to learn commands for a long long time. I still haven't
for example and commands have been around as long as I have (4 years
now). So having to learn commands is not a forgone conclusion.
Jesse