CompSci 308
Fall 2016
Software Design and Implementation

Bins: Code Critique

This exercise is intended to help you to learn to critically read code, understand its purpose, and identify ways to improve its design. Along the way, you should start to build a sense of the reader's expectations about code and what makes one piece of code better than another given a specific set of design goals.

This handout was given previously as an assignment in CompSci 201. Start by reading it and making sure you understand the problem you are being asked to solve.

This code represents a Java solution to the problem described in the assignment. Read over the code to see if you have any questions about how it works.

In groups of two or three, examine the code from the perspective of how readable, testable, and extensible it is. While studying this code, also note any good things about the code, that you might keep in the final version as well as problems with the code.

The following questions are intended to spark your discussion. Record the group's answers in a plain text file (using Eclipse, TextEdit, NotePad, or GoogleDoc, not Pages or Microsoft Word) to be submitted at the end of class.

Readability
Testability
Extensibility

Refactoring

Refactoring is the practice of updating a program to improve its design and maintainability without changing its current functionality significantly. An example of refactoring is creating a single function or class that replaces two or more sections of similar code because it reduces the amount of redundant code within the program and makes the code easier to debug and test.

To make changes to the code, fork the original project lab_bins into your own repository so you can edit, commit, and push your group's own changes.

Examine the given program and refactor it based on your critique and your group's discussion. You may create and comment any new functions or classes you want to help improve the program. Try to justify each change you make by explaining specifically how it improves the code. Justifications that refer specifically to principles discussed in class should be given more weight than those that use terms like "clearly/obviously", "good/sucks", or "like/hate".

Submission

At the end of class, use GitLab's Merge Request to submit your group's answers to the discussion questions above and refactored code to the original organization repository. Make sure the NetIDs of everyone in the group are in the title of your Merge Request and in the text file.