To illustrate how the MVC pattern allows for flexible expansion and reuse of its model, view, and controller elements, we will extend our weather maps example. You may have noticed that there are three types of satellite image maps on the Geostationary Satellite Server web site (http://www.goes.noaa.gov). What if we want to give the user the option of choosing whether to view a visible or infrared image? What changes would be required to extend our weather maps application to view infrared satellite images?
To begin with, we'll need to add another view such as a radio button group to choose the type of satellite image (visible or infrared as shown in Figure 12-5).
Figure 12-5. Extended example showing an infrared map of the West Coast
We will need to create a new controller to handle the user input to the new view element. Our model will also need to hold more data, as we need to integrate five additional image URLs, one for each region as an infrared image. The application logic in the model will also need to be updated to handle the new data. Can we add all these new features without changing existing code? Can we leverage the flexibility and reuse of the MVC pattern without breaking anything?
Let's look at the changes needed to update the model.
Instead of modifying the current weather maps model (Example 12-13), we will extend ...