Michael Jouravlev wrote:
If getters and setters do nothing more than simply read field or set
field, then they are evil, you do not need Rod Johnson to tell you
that ;)

I think I may... why exactly is this evil?

We're talking, at the most basic level, about a construct that encapsulates properties of a modeled object behind a (theoretically) well-defined interface. If you do it right you can change details of the implementation without altering client classes.

This is all nothing anyone reading this doesn't know of course :)

If you mean a class who's accessors and mutators simply do:

return this.field;

and

this.field = field;

...then, while I'm not sure I would call it "evil", certainly that isn't using the concept to its full potential. The public interface should also be "well-behaved", i.e., should handle incorrect data types and nulls and things like that gracefully.

But even that argument seems to me less important than the basic concept of a well-organized data structure to describe some modeled object, and that's what you have even if the methods are doing nothing but like the above.

Why anyone would call that evil I don't understand. Care to convince me it is? :)

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to