My system has an User class with a lot of properties: name, e-mail, address, phone number, etc. And it has also an UserAccount class with properties: username, password and salt. This is a blog application. UserAccount provides login and logout methods. Now I don't know who will be related with Posts. Should an User contains posts or an UserAccount? Thank you.
While I'm not sure why you have User and UserAccount as separate classes to begin with, it sounds like you want UserAccount to be used solely for authentication, so based on the information you gave I would say to relate them to the User Object.
I guess this really depend on how you see it.
Does each user always have one user account or is it possible that a user have more then one user account (and vice versa). I think I would put it in the user class.
if it's a one-one relation, there really is no reason not to merge them together.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With