Posts

Showing posts with the label Pattern




Describe a Situation Where You Would Use the Observer Pattern

Image
You can often experience this problem when working with classes of the graphical user interface. The Observer design pattern defines a one-to-many dependency between objects so that when one object changes state all its dependents are notified and updated automatically. Observer Main issue with Observer pattern is that it can cause memory leaks. . Top 50 Java Design-Pattern Interview Questions. Observer pattern is used when there is one-to-many relationship between objects such as if one object is modified its depenedent objects are to be notified automatically. However as RockoDyne stated the Observer pattern has a different focus. Thats exactly what I intend to do after writing this. The subject holds a strong reference to observers. In C this becomes somewhat simple since events are basically a language-specific means of implementing the observer pattern. Use the Observer pattern when changes to the sta...