Observer Design Pattern vs “Listeners”

前端 未结 3 1484
时光取名叫无心
时光取名叫无心 2020-12-07 10:07

It seems to me that the Observer design pattern as described in GOF is really the same thing as Listeners found in various toolkits. Is there a difference between the concep

3条回答
  •  一整个雨季
    2020-12-07 10:46

    A listener may well be an implementation of the observer pattern. A listener is essentially waiting for an event to occur on a given object, which is what an observer does.

    I know you're not after a language specific answer, but it's kind of hard to talk about this stuff in the abstract. So if I were to investigate this in .NET, I'd be inclined to open an assembly containing a listener in .NET Reflector, which will allow me to disassemble the assembly and check its logic against a design pattern.

提交回复
热议问题