Luis Majano Forums Notification: Post to Form Validation

Title: RE: Form Validation
Thread: Form Validation
Forum: Need Help?
Conference: ColdBox
User: lmajano

I like that you would be able to separate and decouple from coldbox so you can
use it standalone if needed.

As for the structure method you describe, this
follows the Memento Pattern. If all beans are created in such a manner, then
yes you can avoid the mismatches when populating. This could be a good addition
to the factory in which it could check for a setMemento() method and if it
exists, then create a memento structure according to the signature. Then pass in
the memento and inflate the object's state. This is really interesting and
unobtrusive. You basically follow the Memento pattern to infalte an object's
state. This in turn would not create any errors and then the bean itself could
have its own validate() method that complies.

As for your validator object, I
do not quite see the rational of creating yet another object to do your
validation, when In "my eyes" the object should be smart enought to validate
itself. Not following a full active record pattern where it saves and updates
and deletes itself, which it can if you wanted too, I prefer delegating that to
a service. But, for validation, I see the bean container to be a perfect place
for it.

Can you describe more of what you envision a validator?

Do you
believe following a memento pattern for the inflating of an object's state as a
good idea?