Lab 8, CSC 101

This lab provides additional experience with functional decomposition. You are asked to examine a provided program and decompose the program into logically separate functions.

Download lab8.zip, place it in your cpe101 directory, and unzip the file.

Decomposition

In the detab directory, in detab.py, you will find a program that replaces tabs with an appropriate number of spaces (i.e., a tab "moves" to the next tab stop and this program assumes that tab stops are 8 spaces apart).

This program is, quite horrifically, written entirely in the main function. You must identify the logically separate parts of this program and move them into separate functions. (You may note that this program does not have any associated unit test cases because ... well, how would you test something like this?)

The program should continue to work after you have decomposed the problem. To compare the output file (detabbed) with the expected file (detabbed.expected) you can use the diff program. Type diff detabbed detabbed.expected. If there are no differences, then you will see no output.

Demonstration

Show your decomposition to your instructor. Be prepared to discuss the new functions that you have created.