On 29 Jul 2013, at 13:12, Peter Morris <[email protected]> wrote:

> Personally, I would be a little uncomfortable with this. mostly because it 
> feels like you are taking a user 'entity' and splitting it up and spreading 
> its information across your system in different places (user name being 
> stored in session at point of login?) But, I realise that that is just a gut 
> reaction from someone who has ALWAYS done it that way, not for any actually 
> valid reason (that I can immediately) articulate.

Heh, this is exactly how I felt. I wrote this code in the validate-the-user 
style first because that's how I've always done it. Then I realised I had no 
logical justification for this at all, so I refactored it, and now the code is 
simpler. Maybe an undiscovered requirement will introduce a need for the 
username in the User, and reveal the source of my uneasy feeling. Or maybe it's 
just a transient thing while I shake off some deeply-held assumptions about how 
software is written.

Re spreading information around: I considered that with validation, which is 
now separate from the User. The question I asked myself was – once some policy 
or other has decided what usernames are allowed, does the behaviour of the User 
depend on that in any way? My answer was that currently, no, it doesn't. The 
analogy I drew was that if there was some legal requirement on the name my 
parents could give me, once that has been decided, my behaviour won't change. 
Well it might if they'd decided to call me Sue, but not in any way that 
corresponds to a user account in a software system.

Cheers
Ash

-- 
http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashmoran

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