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.

  1. What is the relationship between a bowler and a game?

  2. (Hint: think about how you would model a game between two bowlers versus two games by a single bowler.)
  3. What is the purpose of the function Bowler::TakeTurn?  What assumptions does it make?
  4. What is the purpose of the class Frame?
  5. Why is there a Vector object in the class Frame?
  6. What part of the code depends specifically on the 10th frame?
  7. 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. Additionally, answer the following questions:
  1. How helpful were the comments?

  2. 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?
  3. The following functions are kind of long. How would you divide them up to make them easier to understand?

  4. PlayMatch
    Stats
    Game::TakeTurn
  5. What is the purpose of the skill level?  What is its range?  How did you find that out?
  6. 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?