The Saga of Blog

Last night, I did a complete ground-up rewrite of Blog. I was very, very happy with it, until radix asked why I wasn't using Form. (I used InputHandlers in the way I had originally written them, and finally got them to work) While with InputHandlers, the validators were able to validate one piece of data and call a method when input was valid, Form just collects multiple Arguments (InputHandlers, encapsulation of input validation code) into a MethodSignature and lets you bind the method signature to a method. If you use a FormProcessor, passing the bound FormMethod, and all input validation passes, the method gets called. Simple.

But it's not so simple. There are lots of moving parts I don't fully understand... why are MethodSignature construction and FormMethod binding separate steps? Couldn't you just pass the method to MethodSignature's constructor, and have the FormMethod functionality on the MethodSignature object? Also, are you meant to subclass FormProcessor and override errorViewFactory and viewFactory? I think it would be nicer to pass a callback and errback to FormProcessor. Maybe if I talk to glyph about it, we can simplify the interaction between all these parts, ditch InputHandler, and write some documentation.

No comments: