Activity - Cohesion and Coupling
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():
- process and validate command-line parameters
- initialize data structure index and build it
- save index data structure into a file
- 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.