I'm facing this week a problem, so I decided to use an approach that I'm not sure is right. So I need your help to help me understand what I'm possibly doing wrong.
I have two types of users: Internal and outsourced, they have some attributes that differs one of the other. What I think to do was.
So I created a employee class, that aggregate all the common attributes
public abstract class Employee {
private String name;
private String address;
private String telephone;
private String cpf;
private Integer age;
A outsourced class that have 2 more attributes
public class Outsourced extends Employee {
private String companyName;
private Date endDate;}
And a Internal for internal users.
public class Internal extends Employee {}
Is it right to have this internal class or I should use the employee for the internals? have a class with no attributes seems to be wrong to me, but at the same time I think that use the employee class for internal user to generic, if one day we create a new kind of user we my have some problems.
Anyway thanks for any help :)