Due: Before class Friday, Oct 31.
Objective: This activity is intended to help you to learn to critically read code, understand its purpose, and identify ways to improve it. Along the way, you should start to build a sense of what makes one piece of code better than another given a specific set of design goals.
Look at the complete Java solution to the bin-fitting problem. Start by reading it and making sure you understand the given code. Next, examine the code from the perspective of how it may have been debugged and tested and how it may be extended in the future. Think about its strengths and shortcomings. Specifically, answer the following questions:
While studying this code, please note any good things about the code that you might keep in the final version as well as problems with the code. You will turn these notes into a short report that is submitted with the assignment.
You should examine the given program and refactor it based on your critique and our discussion in class. You may create (and comment) any new functions or classes you want to help improve the program; however, you should justify each change you make by explaining specifically how it improves the code in your Code Critique.
Additionally, you should provide a set of JUnit tests as well as a driver program that verify your modified program still works as intended.
To help you get started, copy
this DiskTest.java class. Note: this
class assumes that the Disk class has a constant:
public static final int GIGABYTE = 1000000;
Why was this constant introduced into the Disk
class?
You can and should put this test class into a package.
After refactoring your code, go back through your code, thinking about the questions that were asked in Understanding the Program. Are there additional changes you should make?
In a text file called CRITIQUE, describe what you like and don't like about the code. Describe how you addressed the parts that you don't like and why you chose that approach.
Create a Jar file from your project and copy it into
an assign10
directory. Your code critique
can be inside the assign10 directory or inside the Jar file itself.
Your grade will be based on