Hello Everybody
Hello Everybody,
I would like to ask you interesting question. I am sure it is too simple for ones.
What technique do you use to validate set object properties?
Do you use plain objects without any logic and then write helpers for complex logic setters to keep classes simple? Or do you write all validating logic in the methods of a class? Or...?
What is most effective validating pattern?
Regards and Thanks
I would like to ask you interesting question. I am sure it is too simple for ones.
What technique do you use to validate set object properties?
Do you use plain objects without any logic and then write helpers for complex logic setters to keep classes simple? Or do you write all validating logic in the methods of a class? Or...?
What is most effective validating pattern?
Regards and Thanks
Stefan Glienke Yeah, for sure Spring4D is first place where I checked the pattern. I have found it and will study carefuly. Thanks a lot.
ReplyDeleteSébastien Paradis Build the Specification Pattern (or use an existent) and define some common specs for common cases like email address validation. You will end up with something like
ReplyDeleteif CommonSpecs.IsValidEmailAddress().IsSatisfiedBy( aEmailAddress ) then
or with a composite
if ( CommonSpecs.IsValidEmailAddress() and CommonSpecs.EndsWith( '.de' ) ).IsSatisfiedBy( aEmailAddress ) then
Ok Oliver Münzberg I got it. Didn't knew this specification pattern yet (there are so much) but it looks like what I already use for validation: sequential checking, but not chained nor composite. Thanks for information.
ReplyDelete