Reputation:
There's a term that's used to describe a type of class that exposes its member variables as public. Does someone know what I'm talking about? I think the term hinted at not a kind of design pattern, but it did describe why the class is used that way.
If you would like an example...
public class HoldsLotsOfStuff {
public String forgetMeNot;
public String anotherThingToRemember;
public int size;
// etc.
}
And then instead of using accessor methods, you would just do this (I understand it's not recommended, btw):
stuffHolder = new HoldsLotsOfStuff();
stuffHolder.size = 10;
stuffHolder.forgetMeNot = "flowering plants lalala";
Thanks.
Upvotes: 0
Views: 71
Reputation: 10084
Josh Bloch referred to classes which:
as degenerate classes in Effective Java, 2nd Ed.
Upvotes: 1