Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 3
    The problem is that the question (and your answer) are about how to do things "in general". The fact is, we never do things "in general". We always do specific things. It is necessary to examine our specific things and measure them against our requirements in order to determine whether our specific things are the correct things for the situation. Commented Apr 3, 2014 at 4:40
  • 1
    @JohnSaunders I perceive your wisdom here and agree to an extent but there is also mere conceptual approach required before addressing a problem. After all, the question here is not as open-ended as it seems to be. I think it is a valid OOD question any OO designer faces in the initial usages of OOP. What is your take? If a concretion helps, we could discuss building an example of your choice. Commented Apr 3, 2014 at 4:48
  • I've been out of school for over 35 years now. In the real world, I find very little value in "conceptual approaches". I find experience to be a better teacher than Meyers in this case. Commented Apr 3, 2014 at 4:53
  • I don't really understand the class for data vs class for behavior distinction. If you abstract your objects properly, there is no distinction. Imagine a Point with getX() function. You could imagine it's getting one of it's attribute, but it could also read it from disk or the internet. Getting and setting is behavior, and having classes that do just that is completely fine. Databases only get and set data fwiw Commented Apr 4, 2014 at 6:24
  • @ArthurHavlicek: Knowing what a class won't do is often just as useful as knowing what it will do. Having something specify in its contract that it will behave as nothing more than a sharable immutable data holder, or as nothing more than a non-sharable mutable data holder, is useful. Commented Apr 4, 2014 at 22:44