Chiming in a little late, but oh well :)

I'd say that no, you don't need to keep the username around. The username
is an authentication artifact used to locate a particular identity, not
part of the identity that the User represents. Obviously, the username
could be dual-purposed as part of this identity (in the form of greetings,
display name, etc.) but that role could just as easily be fulfilled by a
display_name attribute that defaults to the username in the persisted data.

Dave W



On 29 July 2013 17:04, Kevin Rutherford <[email protected]>wrote:

> >> 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.
>
>
>

-- 
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