Search code examples
.netdesign-patternseventsobserver-pattern

How is the Observer pattern different from an Event driven model?


I am a senior level developer but I haven't had a lot of formal training and I although I have used many design patterns and seen them used in my years as a developer, no one really went out of their way to say. "Oh this is an observer pattern, or this is a Singleton pattern."

Reading over some of the design patterns, I came across the Observer pattern and it seems to be to be very similar to the way the .NET framework events work. Am I missing something fundamental about this?


Solution

  • The .NET Event model is pretty much a integrated implementation of the observer pattern in the common language runtime. The .NET languages implement observer directly in their language specific manner, using the framework's built-in support for this.

    In most programming languages, the observer pattern requires customized development or libraries.

    It comes for free as part of the language in C#, VB.NET and most other languages built to use the CLR.