WordSearchSolver Design Review Activity

CPE 103 Lab


Goals
1. Improve software design knowledge by studying some one else's solution to a problem you solved.
2. Learn to improve your techniques by receiving constructive criticism on your own design.


Directions

If you completed project 2 as a pair, perform this lab as a pair.  Otherwise, complete it individually.

Find another person (or pair) with whom to exchange source code printouts. Write "Reviewed by: " and your name(s) on the top of the printout.

If the source code printout is not monospaced font, or if it is smaller than 10 point font, write a zero at the top of the printout and return it to the author.   Ask the instructor to help you find someone else to review.

Read the source code to comprehend how the program solves the problem.  A good design will exhibit properties we have been discussing in class: correctness, simplicity, readability, modifiable, flexible, reusable, etc. If you can't understand how the algorithm works after 5-10 minutes of study, it's probably not a very good design.  If the solution is more than three pages long, it's probably not a very good design.

Step 1.  Below is a list of common problems found in the WordSearchSolver solution.  For each item in the list, review the source code to see if that flaw was made in the program.  if so, circle the offending section of code and make an annotation describing the problem.

  1. Not decomposing the solution into small private helper methods.
  2. Using integers from 1 to 8 for directions instead of PuzzleWord.Directions.
  3. Checking first letter of word separately.
  4. Not putting letter comparison code in a separate method.
  5. Using a loop to copy each element of the grid.  Just save the reference to the grid, don't copy it.
  6. Any action that is repeated eight times is a poor design.  It should occur once, in a method, that is then invoked from a loop that iterates over PuzzleWord.Directions.values().

Step 2.  Here is a list of common Algorithm Design Flaws.  For each item in the list, review the source code to see if that flaw was made in the program.  if so, circle the offending section of code and write the number of the item in the list.

As you are reviewing the solution, if you see anything that impresses you or is well done, write a complimentary remark.

Step 3.  Return the printout to the author so they can benefit from your feedback. 

Step 4.  After you have read the comments from the person who reviewed your solution, place the source code listing on the instructor's desk.

Lab Writeup

Make an entry in your lab notebook describing what you learned from this activity.