On Jul 21, 2004, at 2:05 PM, Ralph Johnson wrote:
We are trying to find out when to commit an action,
and what arguments
the
action used. Because the request is handled automatically, it is hard
(it
may be impossible) to intercept the request. Because the callbacks in
an
action are executed multiple times, it is hard to tell when something
important it happening.
You are falling into the fallacy that shorter code makes for a simpler
system. Callbacks might be easy for you to write, but they are hard
for
everybody else to read, and in the long run are a bad idea.
I would MUCH prefer a completely manual handling of request and
response
fields.
Ralph,
I don't know the SmallWiki codebase, so I can't comment on the
specifics. But I can certainly speak to trade-offs between manual and
automatic request handling.
With all due respect, I think you should consider the possibility that
the problem is in your design, not Lukas'. IIUC, you're trying to
capture modifications to the model, but you're doing this at the
controller layer, or even lower: the equivalent to the Sensor in a
classic MVC system. Might it not work better if you intercepted the
actual messages sent to the model instead?
Now, I admit that a simpler (more verbose, harder to maintain) UI
architecture would make it easier for you to do the wrong thing here,
and intercept at the UI level instead of the model level. By analogy,
it would be very easy to create a "prevayler" system for a unix
filesystem by capturing all the shell commands and playing them back.
It would be much harder, and much less reliable, to capture all the
mouse clicks and keystrokes handled by the Mac OS X Finder to do the
same tasks, because it processes them "automatically" - which is to
say, those events have no semantics out of the context in which they
were made. You would probably be very frustrated if you decided you
were going to implement a journalled filesystem by capturing and
replaying all the UI events sent to the Finder application, but I'm not
wholly convinced that it would be the fault of poor design on the part
of the Finder. Nor am I convinced that we should all be writing
command line tools exclusively, or that we should manually process
every mouse click in a GUI application we're writing, on the grounds
that it's "easier to read" (though certainly harder to write) that way.
I'm not trying to dismiss your concerns - clearly there is a problem
here, and I'd like to explore it further. But I thought an alternate
point of view might be interesting.
Avi