Hi Carl Yes. I did use interfaces to decouple to objects, but that actually doesn't help a lot, because you still need to write the implementation code for each object that implements the broadcaster/observer interfaces. What a pain!
Is you name spelt with a "C" or a "K"? I suggest an enumerated type....snigger. Todd. ----- Original Message ----- From: "Karl @ Work" <[EMAIL PROTECTED]> To: "'NZ Borland Developers Group - Delphi List'" <[email protected]> Sent: Monday, May 15, 2006 11:38 AM Subject: RE: [DUG] Discussion & Donation > >I have implemented the observer pattern previously with the lists > maintained internally by the objects involved, so removing the need to > inherit from a particular class is a great improvement > > That is what interfaces were made for. Create an interface for receiving a > type of broadcast notification, and support it in the object types that you > want to be able to receive such. Your notifier's lists of different types > of listeners can become a single list of interfaces, and hence your notifier > can broadcast to the interface methods without worrying about what types of > objects it is dealing with, requiring them to inherit from particular > ancestors, or having to do TMethod casts (which provide little flexibility > anyway since target method parameters still have to conform to those of the > broadcaster). > > Cheers, > Carl > > _______________________________________________ > Delphi mailing list > [email protected] > http://ns3.123.co.nz/mailman/listinfo/delphi > > > > -- > Internal Virus Database is out-of-date. > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.5.1/327 - Release Date: 28/04/2006 > > -- Internal Virus Database is out-of-date. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.5.1/327 - Release Date: 28/04/2006 _______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi
