6.031
6.031 — Software Construction
Spring 2021

Problem Set 0 Addendum

Addressing code review comments

For all problem sets in this course, you are expected to address code review comments in your beta submission.

For Problem Set 0, however, that expectation is stronger in one specific way: if Checkstyle complained about any magic numbers in your code, you must fix them. For this problem set, all magic numbers must be eliminated from your beta submission. You can’t address them by simply writing a comment saying that you disagree with Checkstyle.

This is a required part of your practice with Problem Set 0. You should apply the principles of the course in this specific way, to avoid magic numbers.

Before you start revising, make sure to turn on Checkstyle in Eclipse so that you can see where your magic numbers are.

Then, think about how to write your code so that it is:

  • safe from bugs, so that dependencies between constants are expressed by computations as much as possible, so that a future maintainer could (for example) figure out how to scale your personal art by 2x without introducing bugs.
  • easy to understand, so that (for example) the role of a potentially-mysterious number like 4 is instead described by a clear name like sidesOfSquare.
  • ready for change, so that (for example) if the Turtle library suddenly switched from using degrees to using radians, it won’t be hard to find the constants in your code that represent angles, and you would only need to make a small change to adapt.

If you have questions about good ways to eliminate magic numbers, please ask on Piazza or in lab hours!

Fixing test failures

And during each problem set, you will receive an alpha autograding report that shows the results of hidden tests Didit ran against your code: tests to check the correctness of your implementation, and in many cases, tests to check the correctness of your tests!

Those hidden tests remain hidden as you revise for the beta. You will not see results on those tests again until the beta autograding report.

Before you start revising, review your autograding report and write regression tests that reproduce any failures.