Question: On pages 352-353 of the Grand book, he gives several methods that an Observer object can use to gain access to the state of an Observable object. Give specific examples for each of these methods. By "specific example" I mean that you should describe the example and then show the actual interfaces (in C++) for Observable and Observer. Try to use the same example or examples in the same family if you can but the inportant thing is for each example to be a good example for the method you are describing. Answer: Here is the first method described in the grand book. The “add methods” example. In this method the ObservableIF interface has methods that enable the observer objects to get attribute values from it. All the class implementing the ObservableIF must have a common set of attributes that enable the observer to act on notifications. This is a good solution. In my instance I made a window interface that supports windows that can be resized horizontally and vertically and will notify observers when their state changes. The observers use the assessor functions to take the appropriate actions. class ObservableIF{ public: Virtual bool addObserver (ObserverIF input) =0; Virtual bool removeObserver (ObserverIF input) =0; Virtual int getHorSize() =0; Virtual int getVerSize() =0; } class ObserverIF{ public: virtual void Notify(ObservableIF input) = 0; } Here is the second method decribed in the grand book. The “multiple interfaces” example. In this method you use multiple interfaces and overload the notify method for each of these interfaces. Making observer objects aware of multiple interfaces is just as bad as making them aware of multiple classes and as such is not a good solution. class ObservableIF_1{ public: Virtual bool addObserver (ObserverIF input) =0; Virtual bool removeObserver (ObserverIF input) =0; Virtual int getHorSize() =0; Virtual int getVerSize() =0; } class ObservableIF_2{ public: Virtual bool addObserver (ObserverIF input) =0; Virtual bool removeObserver (ObserverIF input) =0; Virtual void getSize(int& verticalSize, int& horizontalSize) =0; } class ObservableIF_3 ……n{ //… } class ObserverIF{ public: virtual void Notify(ObservableIF_1 input) = 0; virtual void Notify(ObservableIF_2 input) = 0; virtual void Notify(ObservableIF_3 …..n input) =0; } Here is the third method described in the grand book. The “parameters” example. In this method you pass the attributes needed by the observer objects as parameters to their Notify method. Some knowledge of each other is needed between the Observable and Observer classes and changes to one could necessitate changes to the other. class ObservableIF{ public: Virtual bool addObserver (ObserverIF input) =0; Virtual bool removeObserver (ObserverIF input) =0; } class ObserverIF{ public: virtual void Notify(int horizontal, int vertical) = 0; } Here is the fourth method described in the grand book. The “no interface” example. In this method the same thing as in method two is done. Except the ObservableIF interface is done away with and the observable objects are passed in the notify method. The Notify method is overloaded for each Observable class. There is no ObservableIF interface. But for an example: class Observable_1{ public: Virtual bool addObserver (ObserverIF input) ; Virtual bool removeObserver (ObserverIF input) ; Virtual int getHorSize() ; Virtual int getVerSize() ; } class Observable_2{ public: Virtual bool addObserver (ObserverIF input); Virtual bool removeObserver (ObserverIF input); Virtual void getSize(int& verticalSize, int& horizontalSize); } class ObservableIF_3 ……n{ //… } class ObserverIF{ public: virtual void Notify(Observable_1 input) = 0; virtual void Notify(Observable_2 input) = 0; virtual void Notify(Observable_3 …..n input) =0; } As the grand book states this method is desirable if there is only one Observable class that is sending notifications to many Observer classes Then you have: class Observable{ public: Virtual bool addObserver (ObserverIF input) ; Virtual bool removeObserver (ObserverIF input) ; Virtual int getHorSize() ; Virtual int getVerSize() ; } } class ObserverIF{ public: virtual void Notify(Observable input) = 0; }