Latest News

 










Exercises

Previous slide Next slide Back to first slide View graphic version


Exercises


 
My other sites

Latest News

 










Exercises

  • Choose one of the design patterns presented in this section and implement it in the context of yesterday’s figure drawing example. What would you have used instead, to provide the same functionality? Can you detect the advantages and disadvantages of using the pattern in that context?

  • Design and implement a simple thermometer class that uses the Observer pattern to register its views. On change, the thermometer object should notify its dependent views to update accordingly. You can use the command pattern to change the temperature value of the thermometer.

    Thermometer

    observable

    observers

    fTemperature 15.3

    15.3C

    15.3

    15.3

    notifies on change

Previous slide Next slide Back to first slide View graphic version