Due: Before class next Friday.
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. You should also get more comfortable using the Eclipse Refactoring tools.
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. Remember the goals of refactoring: improving its design, maintainability, readability, testability, and debuggability (?!). 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, a test case was provided for you in the tar file.
One of the reasons that I explicitly require testing for this assignment--besides that you should be testing!!--is that poor design often reveals itself when you're trying to write test cases and you realize that it's difficult.
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?
Finally, using your refactored code, you should add three additional bin packing algorithms:
Change the program to print the algorithm that produces the smallest sets of disks required to fit all of the files. In case two algorithms produce the same number of disks, the first algorithm tried should be the one printed.
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. (Note the original questions in Understanding the Code section above.) Justifications that refer specifically to principles discussed in class will be given more credit than those that use terms like "clearly/obviously", "good/stinky", or "like/hate".
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