I am wondering what are the differences between an observer pattern and MVC. I have some experiences writing MVC program in Java at school, but no experience with observer pattern. (someone told me that observer pattern means I used the Observer class in Java... I don't think that's a good answer.)
Please help me with the following questions, thanks a lottttt.
What is the difference between them? The observer pattern does not uses a separate class for controllers?
What is the relationship between observer pattern and MVC? I heard two different versions.
Is it possible to use only one of them? If so, in what cases, you uses one over the other and why?
I hope this answers Your other two question too.
Observer Design pattern is a Behavioral pattern which is used when we want to notify all of the dependents of an object(say x) in the event of change of the object x. Good read: http://www.dofactory.com/Patterns/PatternObserver.aspx
And they both are closely related, as MVC you would see from MVC diagram - for example: A Change in 'View' Has to be notified to 'Model' and 'Controller' One efficient way to achieve such feature is Observer design pattern.
Good read: http://en.wikipedia.org/wiki/Observer_pattern
In fact the observer pattern was first implemented in Smalltalk's MVC based user
interface framework.
Hope this helps!
There's a lot of articles related with the questions you are asking. MVC to me is an architectural pattern where it "contains" the observer pattern as well. I believe if one really study the MVC pattern in different real-life projects implementation, there are more than one design pattern in it.
It's either you zoom in, or zoom out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With