O'Reilly logo

Quality Code: Software Testing Principles, Practices, and Patterns by Stephen Vance

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Callbacks, Observers, Listeners, and Notifiers

Pretty much any system that requires a low-latency response to asynchronous events uses some form of callbacks, observers, or notifiers. They can be found in user interface toolkits, in which they are often called event listeners, and distributed systems. Callbacks are a generic mechanism allowing you to supply code that the system invokes when certain well-known events happen. They have a variety of forms, some making creative use of language-specific features. Languages like C, Perl, JavaScript, and others with a procedural or functional flavor use function pointers (Listing 12-6) or function references (Listing 12-7). Object-oriented languages often implement callbacks through implementations ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required