CPS 108 : C++ Code Critique
Spring 1999
Due January 19
You are to understand and ultimately critique the following program
which was given out as a lab a number of years ago. Your analysis
and critique should be handed in electronically. See the submission
policy for more details.
Analysis
You should analyze the code above and determine the purpose of each of
the classes written (i.e., what role does it play in the program). There
are some comments currently in the code, but your analysis should go beyond
these comments. However, it should not be necessary to write more than
a paragraph for each class. In order to determine each class' role,
you should focus on how it interacts with other classes in the program
or how a particular task is accomplished. Although the classes above are
listed in no particular order (other than alphabetic), it might be useful
for you to group like classes together.
From your analysis, you should be able to answer the following questions.
Please include your answers with submission.
-
What is the relationship between a bowler and a game?
(Hint: think about how you would model a game between two bowlers versus
two games by a single bowler.)
-
What is the purpose of the function Bowler::TakeTurn? What
assumptions does it make?
-
What is the purpose of the class Frame?
-
Why is there a Vector object in the class Frame?
-
What part of the code depends specifically on the 10th frame?
-
Explain the frame update algorithm.
Critique
You should critique the code and design of the program in terms of its
C++ style and general readability. Remember, this code was intended to
be given to beginning students to extend. The program has some good
qualities, but the design and code also have some problems. You should
write approximately one page analysis of the code and design. The following
points should help guide your critique.
-
Problems with the code, things that have easy fixes but that show flaws
in use of C++ or coding in general.
-
Problems with the design. There may be immediately apparent problems with
the design of the program/class, but you may find it necessary to think
of how the program might be used in order to make pronouncements on design
flaws. A good design will facilitate changing/extending the code or using
it in new ways.
-
Any other comments are welcome. If you find any good things in the code
note those too.
Additionally, answer the following questions:
-
How helpful were the comments?
What would make them more helpful?
How do the comments get at the important aspects of the code?
Which were the best comment? worst? your favorite?
-
The following functions are kind of long. How would you divide them up
to make them easier to understand?
PlayMatch
Stats
Game::TakeTurn
-
What is the purpose of the skill level? What is its range?
How did you find that out?
-
When you try to compile the program with the provided makefile, you will
see three warnings. What do these warnings mean?
Does your answer (or the effort needed to discover the answer) to any of
the questions change your overall critique?
Comments?