You get a bonus - 1 coin for daily activity. Now you have 1 coin

8.4. Maintenance of the software application

Lecture



The complete implementation of the system under consideration is not overly large - only about 20 classes in all. Nevertheless, for any working piece of code a subsequent modernization stage is inevitable. Let us consider what would have to be done to implement two additional requirements for our system.

Clearly, the system makes it possible to measure many weather parameters, but not all of them. It may turn out that users also want to measure the amount of precipitation. What changes would then have to be made to the program?

Fortunately, we will not have to change our architecture radically; we will only need to extend it. Using as a basis the architectural blueprint presented in Figure 8-13, we can identify the following necessary changes:

  • Creating a new sensor class RainFallSensor (a rainfall sensor); determining its optimal position in the sensor hierarchy (RainFallSensor is a kind of HistoricalSensor).
  • Updating the SensorName enumeration.
  • Modifying the class DisplayManager so that it displays the parameters read from the new type of sensor.
  • Modifying the class InputManager so that it handles pressing the new RainFall key.
  • Properly including instances of the class RainFallSensor in the collection Sensors.

We may encounter a number of further, smaller tasks involved in integrating the new class into the already existing architecture, but in any case neither the architecture itself nor the main mechanisms of the system will undergo serious changes.

Now let us consider an entirely different functional property: suppose we want to provide the ability to transmit the data collected during the day to a remote computer. To implement this task it is necessary to:

  • Create a new class SerialPort responsible for controlling an RS232 serial port.
  • Develop a new class ReportManager responsible for preparing the information for recording in a particular format. This class mainly uses the resources of the collection class Sensors and of the specific sensors associated with it.
  • Change the implementation of the function Sampler::sample so that it additionally provides periodic servicing of the serial port.

The mark of a well-thought-out object-oriented architecture is that changes do not destroy it but extend it, preserving the existing mechanisms.

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Object Oriented Analysis and Design"

Terms: Object Oriented Analysis and Design