• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Could someone explain the listener pattern

 
landon manning
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A friend suggested that I use the listener pattern for a project that I'm working on. Could someone explain the the implementation of the listener patern.
Thanks in advance
Landon Manning
 
Glen Tanner
Ranch Hand
Posts: 147
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bill Venners wrote a good article a while back.
"The Event Generator Idiom" http://www.artima.com/designtechniques/eventgen.html
 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is also known as the Observer pattern or Publish-Subscribe. This is one of the patterns from the Design Patterns book.
John
 
Glen Tanner
Ranch Hand
Posts: 147
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
True. The article describes how to make an object Observable, since the Observer-Observable pattern is generic.
 
Linda Rising
Author
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by landon manning:
A friend suggested that I use the listener pattern for a project that I'm working on. Could someone explain the the implementation of the listener patern.
Thanks in advance
Landon Manning

Hi,
You might also check out:
http://www.web3d.org/WorkingGroups/vrml-eai/impl/migration.html
and tell me if it helped and maybe you can win the book of the week :-)!
Linda

------------------
Linda Rising
Author of The Pattern Almanac 2000
 
Tony Chen
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As mentioned in the course OOUML I'm taking right now, Observer is also known as Publish-Subscribe & Dependents Patterns.
Problem:
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
Participants:
Subject, Observer, ConcreteSubject, ConcreteObserver
a.k.a.:
Publish-Subscribe, Dependents
Known uses:
Java's Observable class and Observer interface.
Java's Model-View-Controller (MVC) architecture in Swing.
Java's Delegate Event Model.
IBM VisualAge Notification Framework used in Smalltalk and C++ Visual Builders.
Microsoft Foundation Class (MFC)'s Document View architecture.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic