Technites (technites) wrote in ood,

Accessors and Evil

It's been about a year since I read Allen Holub's (fairly) infamous tirade on the evils of accessors.

The article's heavy-handed and designed to be inflammatory, but there's a core of truth. Former procedural programmers (and VB programmers!) seem to care only about an object's attributes. O-O programmers care more about object behaviour. Case in point: at university, my systems analysis lecturer described objects as "like [database] tables with functions".

Holub's suggestion of business objects with 'drawYourself()' methods seems pretty disastrous for a large system, and his argument that "you're not really putting UI code in the business logic tier, because Swing is just an abstraction" doesn't hold water. Still, it made me think, and that's always good. How about using something like the memento pattern? How about passing attributes as Strings?

At what point does pragmatism win out over purism?
  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 1 comment