1
Need to model the classes of a system where will have 2 types of User, the common user and the administrator, what is the best way to model this? Well I will specify the attributes that each one needs in my application:
Common user: name, login, password, email, age, address etc...
Administrator: name, login, password, email...
What’s the right way to model yourself? I thought the following:
Abstract User Class:name, login, password, email.
Common User Class inherits User, and will have its particularities.
Administrator class inherits User, and has nothing to +.
Is it right for an administrator to be without any particulars? For if he inherits User, it is already done, or if the administrator class will be blank, that is correct? if not which is the best way? thank you
Do you want to model a technology-independent user system? There are Frameworks that already do this work for you, but rely on technology.
– Leonel Sanches da Silva
I want a model only, this is for any technology.
– War Lock
I still defined myself on this question, I do not know if it is not clear or is very broad. In my conception it is difficult to answer it. Unless you just want to know if your initial idea is good, if there are any problems in general. If so, you are on the right track, nothing wrong. But without details, it’s hard to answer. Deep down if you have all the details you will almost have the answer for yourself and then there may be very specific questions that probably fit perfectly here.
– Maniero
I do not see why the distinction between ordinary user and administrator, since the administrator is no longer a user with all the privileges of the system (or at least the "configurational"). But the question is very based on opinions, complicated to answer...
– Vinícius Gobbo A. de Oliveira
You just started modeling and are already using inheritance? Inheritance is to use when you need, not to use just because it exists. Your modeling is wrong; use attributes or user groups to distinguish permissions and not inheritance. Also, the question is very generic, does not offer enough details for a good answer.
– Caffé