Homework: Code Review

Due: Thursday, April 18, at 10:00 AM

Introduction

You have just implemented a small interpreter for Huey, a language for processing colors, as Homework 9. You not only had to implement the specified behavior of the language and interpreter, but you also had to make many software engineering decisions that come with writing a small set of programs, from decomposing functions to naming functions, parameters, and local variables.

You probably have as many questions as answers at this point. Whenever I write a program this large, especially in a new area, I usually have a lot of questions, too.

For this homework assignment, I ask you to think about the architecture of an interpreter by reading a sample implementation of Homework 9. In Session 26, we will do a design review of this implementation.

This assignment is worth 10 points, one-half the usual homework assignment. Together with Homework 0, they make a full assignment.

The Assignment

  1. Download this zip file.
    It contains a sample implementation of the Huey language for Homework 9. It follows the file structure specified in the assignment, so you should have a good sense of how the code is organized from your own experience with the homework.
  2. Read the program.
    Pay close attention to the code. Try to understand how it is doing what it does. The files are only lightly commented, so as not to interfere with your reading.
  3. Answer the questions in the next section.
    Type your answers in a text file or document. You may wish to answer the questions as you read. They will help you focus your attention on some details of the code.
  4. Submit the file containing your answers.
    See the details below in the usual Deliverables section.

The Questions

  1. Questions of fact:
    • Which functions know about the legal unary operators?
    • If we add a new binary operator, what parts of the code do we have to change?
    • How do the arms of eval-exp ensure that its answers are legal Huey values?
    • What kind of expression can cause preprocess to throw an error?
    • Which tests ensure that eval-exp won't try to process an illegal value?
    • Which functions call the list-of? utility function?
  2. Questions of style and programmer preference:
    • What is the best identifier in the code? The worst? Consider the names of functions, function parameters, and global data values.
    • Which helper functions are most helpful in following the flow of the code? The least helpful?
    • What comments would improve the code's readability?
  3. Questions of your own:
    • List at least three questions you have about this code. They can be about any facet of the program: Racket expressions, functional decomposition, design trade-offs, formatting, naming...

Deliverables

By the due time and date, use the course submission system to submit the following files electronically:

Your file may be of any of these types: