Best practices for too many parameters
807607Dec 12 2006 — edited Dec 13 2006Hi,
I have an object with 10 fields. Let's say, for example, a Person class, with 10 attributes (name, age, height...). If I want to set the attributes from a database method that's in another class, but "show" the Person object from within the Person class, I'd rather not have a big constructor with 10 parameters, and I've been reading that 'set' methods are not the best style (e.g. Holub). And I'm quite sure that making the attributes public is very bad style. So what's the best practice for an object with many attributes?
Thanks!