From: Chris Gehlker Date: 2002-01-24T03:47:46+09:00 Subject: Re: OOP UI Design On 1/23/02 11:18 AM, "Bill Kelly" wrote: [thread about Holub's call to ban all getters and setters vs attr_accessor] > Why? In Ruby these aren't relegated to being simple getters & > setters - they're compatible with the Uniform Access principle > ("All services offered by a module should be available through > a uniform notation, which does not betray whether they are > implemented through storage or through computation.", see > http://www.elj.com/elj/v1/n1/bm/urp/ ) > > That is, Ruby lets us start out with an attr_accessor for > :num_monkeys in class Barrel, just getting and setting a > stored value; but if computation should become necessary to > the task, Ruby lets us define Barrel#num_monkeys and > Barrel#num_monkeys= as methods more complex than those auto- > generated by attr_accessor. . . > > . . . Does this address any of your concerns, or am I, like, > totally missing the point? =) No, you are on point. Both attr_accessor and Key-value coding do decouple what you do inside an object from the rest of the world and that's a Good Thing�. Holub seems to be going much farther with his "every object must provide it's own UI", though and I was responding to that. It's still possible to to leave an object in an inconsistent state without violating the Uniform Access principle and I *think* that's part of his point. In fact he says something about not having any data in objects. This is one way to assure that they remain consistent ;). The Morphic folks are a lot more clear about what they mean. And they are coming from what seems to be somewhat the same place as far as leaving the data in the UI. The problem that I have with them is that while I can see how to write a video game using their principles, I don't see how to do a power plant optimization. -- Conversation, n. A fair for the display of the minor mental commodities, each exhibitor being too intent upon the arrangement of his own wares to observe those of his neighbor. -Ambrose Bierce