Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Best practices for too many parameters

807607Dec 12 2006 — edited Dec 13 2006
Hi,
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!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 10 2007
Added on Dec 12 2006
60 comments
1,981 views