C++ Code Critique



You are to understand and ultimately critique the following program which was given out as a lab a number of years ago.

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:

  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.
  8. Explain the algorithm to print out the game's scores.

Critique

You should critique the code and design of the program in terms of its C++ style, design, 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?
    Do the comments get at the important aspects of the code?
     
  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. How would the rest of the code benefit if you added functions, IsMark, NumSpares, and NumStrikes, to the Frame class that reported if the frame contained a mark (either a strike or a spare), and the number of spares and strikes respectfully?
      
  6. What is the purpose of the skill level? What is its range? How did you find that out?
     
  7. Does the program work as intended? How would you test it to verify it before giving it out to novice students?
Does your answer (or the effort needed to discover the answer) to any of the questions change your overall critique?

Comments?