Wednesday, May 30, 2007

What do your objects do?

I was thinking about how most of the system at work has objects that don't do anything (yes, this is the Anaemic Domain Model code smell).
Last week I broke up a control and refactored it into a Model-View-Presenter, as it allowed the right amount of code reuse for what I was trying to do. Also, I extracted some interfaces (including one for the presenter).
Today, I've been trying to explain this to a colleague. I think I missed the point about programming to interfaces rather than implementations, and also the colleague got rather confused about why he couldn't reuse the interface to do his different control. I think mentioning something about intent.
I need to remember that even when following established patterns I need think about what I'm coding.

No comments: