With your group, revisit the indexer design (indexer.c) following the principle of cohesion and coupling.

We ask ourselves this question: How do we decompose indexer.c into functions so that each function contains cohesive operations while the connection among functions is loose?

The main function of indexer.c follows the design below:

indexer main():

  1. process and validate command-line parameters
  2. initialize data structure index and build it
  3. save index data structure into a file
  4. clean up data structures

Now, how would you design the high-level structure of index_build()? How would you further decompose it to functions?

Work with your group, and try to write pseudocode for index_build() as well as its helper functions.