Thursday, March 17, 2005

We were already used to the fact that everything we know is obsolete every two years. Now what? All these familiar things we rely on are actually wrong?

Well, at least, this is what Allen I. Hollub explained this afternoon, to a stunned audience, in a pretty convincing and a very practical manner.

Oh, by the way, we are not fully plain wrong... In fact Allen's pitch was about how what we know about implementation inherence (extends for Java buffs) and accessors (getters/setters) is actually wrong. Okay, Allen could not resist sharing his consideration for EJBs, Struts and the likes, but no-one can blame him for such a diversion.

He made a strong case for agility versus fragility (which reminded me of the fragile manifesto), and explained that by making the code more flexible, we will be truly agile. He made that case by emphasizing how avoiding extends and accessors could help us do that. Here are some key ideas:

  • objects are what they do, not the data they contain,
  • program to interfaces and keep things abstract,
  • extends fragilizes the base class by making subsequent changes risky: prefer encapsulation,
  • accessors are complicated public fields, they are not any better,
  • don't ask an object for data, ask it for help (i.e. make the object do something for you instead of asking data and you doing something with it).
Allen stated that, of course, there are cases when extends is useful (e.g. to avoid code duplication) or when accessors are needed (e.g. at the boundary between the OO world and the outside world).

He added that this approach does not make code smaller nor it completely solves all the problems, but it makes things manageable. No more need to try predicting the future, you will be able to adapt!

Judging by the discussions going on here and there after the class, this speach left no-one insensitive. And that's all the point of this entire week: making us think about what we do and dare improving it.

4:35 PM

2 comments:

at 6:42 PM Anonymous said...

Good design!
[url=http://unxqouxh.com/luhy/mxpc.html]My homepage[/url] | [url=http://najhwdhc.com/xqsz/ltrq.html]Cool site[/url]

at 6:42 PM Anonymous said...

Good design!
http://unxqouxh.com/luhy/mxpc.html | http://ngpfdktn.com/ooph/joxs.html