Info

Figure 7-21. Class diagram for the strategy pattern.

Figure 7-21. Class diagram for the strategy pattern.

Notice that the weather data manager does not have any knowledge of the classes that can provide what the manager wants. The weather data providers are totally independent of the user of the data. This allows for modifying the algorithm that obtains the data without requiring any changes in the user of the data. Furthermore, additional ways of obtaining weather data can be added to the system without forcing the data user to modify its behavior. The user can change the strategy for obtaining weather data without requiring changes to the code. We will see an implementation of this pattern in the second part of the book, in section Java implementation of the Kraalingen model.

0 0

Post a comment