Incremental Development

The Basketball class is extremely simple and it is likely to be obvious to you how to complete it. (Or, you might remember from lab 2.) But let's finish it by doing the following.
  1. Add instance variables to the basketball class representing the diameter and inflated status. Initialize them in the constructor.
  2. Re-run the unit tests. Are more of the tests passing now?
  3. Fix the isDribbleable method.
  4. Re-run the unit tests. Are more of the tests passing now?
  5. Fix the inflate() method.
  6. Re-run the unit tests. Is everything passing now? When all the tests pass, the horizontal bar should be green instead of red. Victory!

Test early, test often!

The process we just went through in finishing the Basketball class is a tiny example of incremental development. This is just a strategy of developing code by making small changes and testing frequently to ensure that the changes you made are working (and haven't broken some other code that was working before). Effective programmers almost always use some form of incremental development.

A framework like JUnit is invaluable for an incremental development strategy because it takes almost no work at all to re-run the unit tests and evaluate the results.

Checkpoint 1

  1. Show the TA your JUnit test and demonstrate it on your finished basketball class.