Re: Is this good use of Properties?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Bill Butler <qwerty@xxxxxxxx> wrote:
>
> "Rick Elbers" <rick.elbers@xxxxxxxxx> wrote in message
> news:j08a81ti69dkulp755m4ksbelh3mr8knvd@xxxxxxxxxx
>
> I hunted around a bit and came up with this:
> "Why getter and setter methods are evil " by Alan Holub
> http://www.javaworld.com/javaworld/jw-09-2003/jw-0905-toolbox.html
> pay close attention to the forum that follows the article.
> (He does not get unanimous acceptance)

<snip>

Ah yes - I seem to remember seeing it before and disagreeing with it
then. The idea that a class should be able to draw itself just in case
it's needed in a UI seems ridiculous to me - which UI should be picked,
for instance? SWT? Swing? AWT? All three? What about a web UI? What
happened to separating presentation logic from business logic? How can
the author of a business class know all the different ways in which it
may need to be drawn?

It puts the onus on a class to know all the ways in which it might be
used, rather than providing something which can be used in a variety of
situations. I can see it working in some situations, but overall I'm
not a fan.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Re: thread sync
    ... > Can anyone shead any light on why the following throws up an exception ... > I cannot put synchroize around the property changes, ... getter and setter methods and/or fields. ...
    (alt.comp.lang.borland-delphi)
  • Re: What is a property?
    ... > It is also possible via getter and setter methods. ... What exact benefit does ... >> not possible to give read-only or write only access to public fields. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to re-use existing classes in JSP/JavaBeans/Servlets
    ... >> Written by Allen Holub, it about the pitfalls of abusing getter and ... > Getter and setter methods are dangerous ... assuming my definition of accessor. ...
    (comp.lang.java.programmer)
  • Is JavaBean only with getter and setter methods A evil?
    ... I've worked for some j2ee prjects and often find lots of objects only ... with getter and setter methods. ... thx. ...
    (comp.object)