|
Posted by Phil Latio on 06/22/07 15:30
> Phil,
>
> Class objects should validate themselves - they shouldn't have to rely on
> outside code. So in your case I would suggest validating in the user
> class.
>
> Also, beware - your "validation" class is probably not an appropriate
> class. Does it have its own members (which aren't members of other
> classes)? Or is it just validating some other class? If the former, it
> would be a valid class. However, it's easy to fall into a trap of the
> latter. In that case it should be a method, not an object.
>
> It's easy to get confused, especially when you get something like
> "validate" (a verb) and "validation" (a noun). One is a method, one is a
> classes.
>
> And btw - "display" is even worse! :-)
Jerry
Many thanks for your thoughts. You make some interesting points and I hadn't
considered taking that approach of validating within the user class or the
form class.
Cheers
Phil
Navigation:
[Reply to this message]
|