LM Tech's blog

Software Architecture & Design Patterns

A callback is a reference to a portion of executable code, that is passed as an argument to other code.
Using callback, for instance, a server program can notify to a caller when the requested operation ends. The callback paradigm can also be used instead of the Observer Design Pattern. In Microsoft .Net Framework, callbacks are implemented using delegates that provides type-safe function pointer.

A delegate is declared using the delegate key-word:

public delegate void OperationCallbackDelegate(int value);
More...



Events are mechanisms that allow application-specific code to execute when an action occurs. In Microsoft .Net Framework events are implemented using delegate (the event handler).

A delegate is a reference type that can be used to encapsulate a method with a specific signature and lets you pass a function as a parameter in type-safe manner. More...



In the observer design pattern an object (the observable) mantain a list of its dependents (the observers) and notifies them when its state changes by calling a method on each registered subscribers. More...