The debate without end
It seems my discussion on "getters/setters" is having a lively discussion at James' and Andreas' blog. Both sides of the argument give great points. But, perhaps we are missing one another. Maybe we should ask ourselves. How could we compromise? I think we can all agree that encapsulation and consistency are things to keep in high regard. We shouldn't have to sacrifice one for the other. Is the obvious answer data objects? Objects with simple getters/setters methods, but encapsulated inside of a behavior object? I'm thinking out loud here. There's a lot of things that we could do with these data objects. They could notify of changes (good for persistence and gui models) without cluttering up the behavior objects and no one outside of the behvaior object should know about them. You could exchange data objects (since all access is via methods).Hmmm, I think I might need to do implement a model using this technique. I'm curious as to what other people might think would be a compromise to this or an alternative implementation. My point is that if we can't decide on which is better (and frankly, while I still side on the side of getters/setters. I still think both have their pluses and minuses), then maybe we should think of a better solution that has the bits that both sides like. Send me email. I'd be glad to discuss this!
Thursday, January 06, 2005
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment