KWIC Implemented with Main/Subroutine Architectural Style

Your Assignment

Modify data representation

You need to modify the way how circular shifts and sorted circular shifts are represented by the KWIC system. In the new version, circular shifts should be now represented in the same way as the original lines, that is:

Modify functionality of the system

You need to provide the existing KWIC system with additional functionality. The new KWIC system should be able to filter out some of the circular shifts that are produced. All circular shifts that start with a number, i.e., all shifts where the first character is a character between '0' and '9' should be removed from the shifts array before the sorting starts.

Hint: Add a new module, i.e., a new function to the existing sytem. The name of the new module can be filter, and it should be responsible for iterating through the produced shifts and removing all the shifts that starts with a number. The main function should call the filter function right after the circularShift function and just before the call of the alphabetizing function.

Thus, the architecture of the new system looks as shown in the following picture. Note, that the modification in data representation is already visible in the figure.

New architecture

Answer understanding questions

Please, answer the following questions:

  1. Which modules from the original KWIC system did you need to modify to implement the new data representation of circular shifts? What conclusion can you draw here? How does the KWIC system implemented by means of main/subroutine architecture with shared data withstand design changes in data representation?
  2. Which modules from the original KWIC system did you need to modify to add filtering function to the system? Was it difficult to add a new processing component (filter function) accessing the shared data? Can we conclude here that the KWIC system with main/subroutine architecture with shared data is robust to desing changes in system's function (assuming that new functions access the shared data)?

Hints:

Valid XHTML 1.0! Valid CSS!