Technites (technites) wrote in ood,
Technites
technites
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?
Subscribe
  • Post a new comment

    Error

    default userpic
  • 1 comment