Is it wrong to have a lot of parameters inside a constructor? Like 10 to 15 parameters? Because I was designing a class where a constructor will have lots of parameters, for example, a Person
class.
My example person class has 6 parameters in its constructor:
public class Person {
private String fName;
private String lName;
private String mInitial;
private int age;
private String contactNumber;
private String emailAddress;
public Person(String fName, String lName, String mInitial, int age, String contactNumber, String emailAddress) {
//insert rest of code here
}
}
Is that wrong? Creating lots of parameters for a constructor?
Then I am planning to create a class named Employee
, then extending it to person class, then it will have a long constructor as well.
The thing that worries me about is the practice, is this good or what? Any other suggestions?