Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+34 votes

I'm not sure about the question 9: Which pattern allows an object to be notified whenever changes occur to some other object? I think it's the observer but the decorator is trowing me off. Is it the observer or decorator and why?

asked in CSC285_Fall2018 by (8 points)

2 Answers

+17 votes
Best answer

This just my opinion, I think that is observer because in the definition of observer pattern, when an object change, it will get notifications.

answered by (8 points)
selected by
+18 votes

I also agree with Duc.

The decorator design pattern is a structural pattern and changes the object itself.

Observer, on the other hand, is a behavioral pattern and implements event handling (ex: adding an event/action after something is completed).

answered by (8 points)