September 08, 2003
Context is everything

It's not often that you read a sentence like the last line in this blog entry without being disgusted.

Posted to Funny by Simon Brunning at 02:25 PM
Comedy attire

While at the Guilfest with Steve this year I spotted a brilliant t-shirt. Turns out it's from meatandcheese.co.uk - it's the 'Jesus' one. My mate Paul spotted one at the weekend, and recalling that I'd mentioned that I wanted one, picked it up for me. Fab!

I don't usually wear anything with writing on the outside of it, but I'll make an exception in this case.

Posted to Funny by Simon Brunning at 12:22 PM
A rose by any other other name...

... would smell as sweet.

Eclipse may take new name after reorganization, basically because the name pisses Sun off, and so they don't want to join the Eclipse consortium unless it's changed.

Thing is, while I have no reason to object to Sun joining the Eclipse team, I'm not sure what the advantage is, either. So why should Eclipse bend over backwards for Sun, and loose the recognition factor which Eclipse has earned over the last couple of years?

Via architectslobby.

Posted to Java by Simon Brunning at 11:56 AM
Getter and setter methods are evil

Why getter and setter methods are evil explains, uh, why getter and setter methods are evil. Don't ask for the information you need to do the work; ask the object that has the information to do the work for you, it advises.

I hadn't really thought about this, but it strikes me as good advice. Looking through my own code, I see almost no simple setter methods, and few getters. I do use 'is' type getters fairly frequently, though. This feels OK to me.

This isn't the same thing as Python's reason for avoiding getters and setters, BTW. Python's descriptors mean that you can directly access object attributes without breaking encapsulation, making getters and setters very un-Pythonic.

Update September 9th: Having thought about this overnight, I'm a little concerned that this might be a bit too purist, a bit too principle of least privilege. Yes, so long as the designer of the class has anticipated every need that a client of the class might have, it's better to encapsulate firmly, and to prevent anything unanticipated from happening. In the real world, the designer hasn't thought of everything.

Have you ever raged that a method or attribute that you need to access has been marked private, because the designer of the class that you are using didn't anticipate your every need? I know I have.

Still, the designer should provide a named method for everything for which he/she does anticipate a need. Access to an object's attributes, be it via setters and getters. or directly, strikes me as a code smell.

Posted to Java by Simon Brunning at 11:03 AM