Let's talk about 'Members'
karimmtarek opened this issue ยท 7 comments
karimmtarek commented
I'm working on this #148 and according to the Domain-Model each member has_many talks, I still can't figure out:
- What's a member?
- Why is it different than a user?
- Do we really need it? or adding a enum field to the user model with different types
[:member, :admin, :guest, :whatever]
can do the trick?
benichu commented
I'll give you my point of view later today, if that's Ok :)
But anyone is free to chime in anytime...
karimmtarek commented
@benichu sure :) I'm looking forward to it.
cawel commented
Here are a few hints, from what I understood:
- The purpose of a
User
is to be able to log in. - A
Member
cannot log in (if it is not associated with aUser
, i.e.member.user_id = nil
). - A
Member
refers to a person in reality, e.g. the talk "What's new in Rails 5" could be given by "Donald Henry Howard" (aka DHH ;) ), and that person would be represented as aMember
entity in db. "Donald Henry Howard" comes from Australia and is only staying in Montreal for 2 days and will never have to log in. Still, his picture, twitter/github handles and email would still be persisted in db as aMember
. - If at a later point in time "Donald Henry Howard" needs to log in because he wants to be more involved with the Montreal.rb community, then we'll create a
User
for him. And his already existingMember
model will then have theuser_id
of that newUser
model we've just created for him. - I hear you saying "why not use the
User
model for both of these scenarios?". Sure, that could have been possible. But I think @nicholasjhenry was attempting to better reflect reality by distinguishing between those 2 entities in the architecture. And we'll probably observe in the long run that we'll have a ton ofMember
's, but only a fewUser
's. Plus, from a security point of view: less users (people who can log in) mean less weak passwords to worry about :)
benichu commented
I agree 100% with @cawel
I would just add:
Member
is a facet of real people interacting with our website's business domain, we could, later on, decide to implement other facets...User
seems to implicitly refer to people, but because the responsibility of that class is to deal with authentication and authorization, it could also be referring to non-human users (like an external API client...). Maybe the proper name for that class should beAccount
which does not presume a human-only bias... If that makes any sense at all ๐
If you have a chance I recommend watching this ruby tapas episode (#346)
karimmtarek commented
cawel commented
@karimmtarek Since you're the one who opened this issue in the first place, feel free to close it if you feel satisfied :)
karimmtarek commented
I feel satisfied ๐