On Wed, 30 Apr 2003 at 20:29 GMT, ahoward wrote:
>> However, it leaves the content of addressbook (the contacts) freely
>> editable by everyone. I hope we all agree to the fact that this is a
>> serious limitation to the interface. Because someone can change a
>> contact without the addressbook noticing, the addressbook cannot enforce
>> any invariant that depends on it's contacts content. i.e.: it can't
>> enforce a no-two-entries-with-the-same-name policy. Nor can we decide to
>> implement the addressbook as a sorted Array anymore.

> i would not agree with these statements.  it is not impossible to maintain the
> referential integrity of the address book and to allow unfettered access to
> contacts.  all that is required is
>   a) contacts can be aware that they are 'contained' (in an address book)
>   b) contact methods use this awareness when ri can be violated

Yes, that is what I meant by a solution where 'the contacts cooperate
with the addressbook'.

> this does, however, tightly couple contacts with addressbooks.  but *aren't*
> they tightly coupled in the 'real' world? 

I don't know ... but I do feel the potential for re-using the Contact
class outside the Addressbook is rather limited anyway so I wouldn't
feel too bad about coupling them.

> in the end - if contacts are aware they are IN an addressbook i think you can
> have your cake (easy access) and eat it too (safe access).  again, i think any
> design will require *some* coupling of contacts and addressbooks since
> contacts are *related* the *context* of an addressbook, but not outside of it
> (eg.  contact 'bob' could be in addressbook A *and* in addressbook B).

I am not sure I would agree here ... a contact can perfectly exist by
itself and have meaning on it's own. Moreover, contacts have no inkling
whatsoever they are being contained, managed and saved by an addressbook
in my current implementation. 

> this is a very interesting topic IMHO - at least for anyone attempting to do
> OO desgin - and this is all ruby programmers right?  ;-)  and therefore on
> topic!

I couldn't agree more.


Thank you very much for the time you took to reply in such a complete
and elaborate manner.


- Simon

-- 
There are 10 types of people in the world... 
those who understand binary and those who don't.