Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news4.ner.bbnplanet.net!news.ner.bbnplanet.net!news.mathworks.com!newsfeed.internetmci.com!in2.uu.net!news.new-york.net!ritz.mordor.com!jpletzke
From: jpletzke@ritz.mordor.com (Jonathan Pletzke)
Subject: Re: [ALL] Does anyone use dependencies?
X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
Lines: 24
Organization: Mordor International
Message-ID: <DKK7CG.KMM@ritz.mordor.com>
References: <4c7026$u5u@watnews1.watson.ibm.com>
Date: Tue, 2 Jan 1996 15:07:27 GMT

David N. Smith (dnsmith@watson.ibm.com) wrote:
:    What good are dependencies?

I use dependencies extensively for GUI and Domain Object coding.  It is 
one of the essential portions of providing good encapsulation in the way 
I write my code.  Instead of manually "telling" instances that a change 
has occurred, I use the dependency mechanism (#changed, #update) to 
notify objects that care.  

Encapsulation is enforced by having the independent object send the 
#changed message to self.  In this way, as many dependent objects as 
needed can be notified to perform the #update message on themselves, 
providing less knowledge inside the independent object of the dependent 
objects.  In addition, polymorphism is also enforced by requiring any 
dependent object to respond to the #update message in a manner 
appropriate for its type, which in turn means that there is greater 
encapsulation in both classes because the independent object knows even 
less about the dependent object.

If anyone was able to follow that, please mail me back and explain it to 
me! ;) ;)

-Jonathan

