I am programming in Java and I have a three classes.
Uno de ellos es
User. The other classes are
UserStudent. Ambos heredan de
I have to implement tables in a mysql database to store the values.
What would you do?
User tiene los atributos
preguntado el 12 de junio de 12 a las 18:06
Make one table with an extra attribute, besides username, pw, firstname, called userType. Was there something else you meant to ask?
Edit. You could also split up the tables into something like:
UserTeacher: firstname, passwd, username UserStudent: firstname, passwd, username User: firstname, username
But I still think the first way is better considering that the teacher and student classes only differ in terms of who they are but not their attributes (well at least not mentioned ones). If you do have a lot of other attributes I'd recomend somethign as follows:
UserTeacher: firstname, username, attr1, attr2, attrN UserStudent: firstname, username, attr1, attr2, attrN User: firstname, username, passwd