in reply to Psychic Disconnect and Object Systems
Even if it did get a bit carried away there towards the end, what BrowserUK said here is, in my opinion, excellent wisdom, well thought-out and presented. I agree with that entire point of view. It has some pretty subtle points in there, but it’s very clearly the voice of experience.
In my own experience, an object (in a programming system, albeit not so much in the real world) is, like everything else in a programming system, most of all a functional thing. Which means, “methods.” And, the tighter and the more self-contained it is, so much the better.
When you expose attributes, you run the calculated risk that there will in the future be other code out there somewhere, unrelated to this object but now functionally dependent on this object by virtue of the fact that it examines those attributes and contains “procedural code” of some kind that depends upon their values. It is a procedural dependency, hidden, as it were, by a data dependency, caused, as it were, by a data exposure. It can be problematic at times. To put it another way ... it is a characteristic that might easily be overlooked with regard to its possible negative implications.
Everything in a programming system ought to have a specific purpose, and you ought to know, insofar as is possible and practical, what that purpose is to be ... before you build it ... and “built for and because-of that purpose.” That statement is an ideal, of course, and therefore not always achievable and not always even desirable.