University of Leicester –
Department of Computer Science
CO7206 - Fall 2003 - Lab 2:
System Understanding / Code Styling
16 / Oct. / 2003
Objective: Learning to
comprehending an unfamiliar system / learning about code styles
Skills: Last time
students had an exercise on code reading. This time students will have an
exercise on system understanding, applied on a real system of moderate size and
practical value. This will develop the students program comprehension skills.
First, the students will try the system as users. Then, they will proceed to
comprehending the system top-down, focusing on the function of various files
and C functions rather than programming details. This system will be subject to
further analysis in coming lab sessions / assignments.
Indent: The system we will be using is the
‘indent’ program. The `indent' program can be used to make code easier to read.
It can also convert from one style of writing C to another. `indent'
understands a substantial amount about the syntax of C, but it also attempts to
cope with incomplete and misformed syntax.
Task:
2-
If you there
is no an executable of ‘indent’ on your machine, build one using MS Visual C++.
3-
Read the
accompanied documentation of Indent and try it to ‘indent’, format and/or
reformat C programs. For example, format the following messy C program on the
left to be as nice as the one on the right. You can also try ‘indent’ on the C
files of the program itself.
4-
Assume that
your were assigned the task of maintaining this software and you need to gain
initial understanding of the system before you can start your job. To do so,
use a top-down approach to comprehend the system, by identifying its components
and their roles. From that draw a sub-system diagram, data flow diagram, flow
chart, or whatever kind of diagrams that represent your findings and submit it
to the lecturer by next lab. Note that the program is written in C, which is a
structured (not OO) language..
* Note, while indent is written in C,
working knowledge of C, C++ or Java will help comprehending the system, but is
not essential. The purpose of this exercise is not to learn to C language, but
is to comprehend a software system, while gaining C knowledge as required as
you go.
Resources: