This question already has an answer here:
- How can you decompose a constructor? 5 answers
I know this has been asked a lot of times but we are talking about entity classes here. Plain dumb objects containing nothing but primitives for properties. The purpose here is to store data. Our entity can be created in a variety of ways, we never know which set of properties will have a value, it is given by real life. Now somebody says that the right way to do it is the use constructors only, listing all possibilities of properties having a value or not. I guess it would make the number of constructors n! if we have n properties. This is obviously not even possible in every case because there can be only one constructor with the same number and same types of parameters. I say there is nothing wrong with setters, that way you just set whatever you got, it's more readable and cheaper.