Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's important to make a distinction between a user and a person.</p> <p>A person has a name, address, DOB , other facts about him. A user has credentials, secret question, system rights, etc.</p> <p>Now, asking yourself what is the relationship between a user and person. As Brian above answered it is a good idea to separate the two into different classes and tables by default, because that will make it easier down the road.</p> <p>Here are some reasoning to break these out.</p> <ol> <li>A user will likely remain the same throughout it's existence, the person attached to the user may not be.</li> <li>The information about the person is rarely needed in the context of permissions and roles, so that is extra data that will be floating around in your user class unnecessarily. This list goes on...</li> </ol> <p>I generally break out the user stuff into the following classes</p> <pre><code> User ( id login password password_expiredate enabled otherflags ) //(occasionally email, if it is used as login) Person ( pid // If it is not one to one between user and person user_id FK Name DOB Email other relevant information ) Address ( person_pid type //home,work, etc Street City State Zip Country ) Phone ( person_pid type number ) </code></pre> <p>As for creating the classes, in general, I am not sure if it is good practice, but I allow the user to contain a person, which in turn contains the Address and Phone classes with the respective functions.</p> <p>In my experience, the normalization of the structure allow for flexible development of business rules that will use people and users.</p> <p>In addition, a person does not have to be a user.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload