>> Then pass the User to a Validator Object. Whether the validator validates 
>> against the username is irrelevant since the username may be used elsewhere.
>
> I wrote it this way at first, then I refactored to validate before creating 
> the User. It simplified the code a lot, as the it no longer has any steps 
> that do nothing but pass the object along to a later stage. I've not yet 
> found any value in putting it back to the other way.

What if your objects had to be immutable?  Would that lead to a
validation pipeline containing objects such as CandidateUser,
ValidatedCandidate, UserAccount etc? And if so, where do the factory
methods for each of those types live?


-- 
http://xpsurgery.com -- remote one-to-one tutoring in TDD and OO
http://kevinrutherford.co.uk -- software development coaching
http://refactoringinruby.info -- Refactoring in Ruby, the book

-- 
You received this message because you are subscribed to the Google Groups 
"NWRUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nwrug-members.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to