Project 1a

Due Date: Mon 19 Sep

Individual Project


  • Transition from Java to Scala.
  • Transition from Comp 313 to Comp 473 (cf. the last couple of projects in Dr. Yacobelli's version of 313).
  • An understanding of
    • Scala programming: case classes, structural recursion, pattern matching, higher-order functions
    • Design patterns: composite, decorator
    • End-to-end, test-driven development (TDD) in Scala and Eclipse


  1. Check out a copy of shapes-scala and study the code. Be sure not to modify the underlying folder structure while working on this project.
  2. Try to run the Main application (right-click inside the editor window > run as Scala application) and the unit tests (right-click > run as JUnit test). Both should succeed.
  3. Perform the steps marked TODO in the comments within the sources provided. When you are done, all six bounding box tests should succeed.
  4. Following BoundingBox, create a size function that counts the number of concrete leaf shapes (such as ellipses and rectangles) in a general shape.
  5. Using the existing test fixtures and following TestBoundingBox, create a TestSize test suite with the same number of tests but for your size function.


  • (1 point) maintaining correct project structure
  • (2 points) add missing case classes
  • (2 points) completion of boundingBox function
  • (2 points) use of map and foldLeft in the completion of boundingBox function
  • (1.5 points) size function
  • (1.5 points) TestSize


Please refer to the online submission procedure.