Project 3

Due date: Friday October 19 (FIRM)

Pair project

If you have not paired up with someone, please do so by September 25 end of day!

Objectives

An understanding of
  • Requirements analysis
    • functional requirements
    • nonfunctional requirements
  • Modeling
    • UML class diagrams
    • UML sequence diagrams
  • Design principles and patterns
    • Dependency inversion principle
    • Composite pattern
    • Decorator pattern
    • Visitor pattern
  • Java coding
    • final-correctness
    • @Override correctness
    • anonymous inner classes
    • basic Android graphics
    • mock-based testing using Mockito

Description

In this project, you will complete the implementation of the simple API for drawing graphical shapes. The API design is based on the requirements from an in-class group activity.

See also the practice midterm and its attached solutions, on which this project is based: http://laufer.cs.luc.edu/teaching/313/handouts/practice-midterm

See also these examples: expressions (how to process simple arithmetic expressions) and vexpressions (how to do the same with visitors / the Visitor design pattern).

Functional requirements

Start with this code skeleton: https://github.com/LoyolaChicagoCode/shapes-android-java/The functional requirements are embodied in the JUnit tests in the test folder; instructions for running the tests are included in the README file and in the Notes below. When your code passes all the tests, you will have fulfilled the functional requirements for grading purposes. If some of the tests do not pass, you will receive partial credit. In addition, your app should produce an output that looks exactly like this screenshot: http://t.co/gaYmzRki when run on an emulator or Android device.

Notes 
  • See below under How to submit for how to name your imported Bitbucket repository (this uses the standard course naming convention).
  • Use Android Studio to check out / clone your imported Bitbucket Project, and don't Open it immediately, instead say "No" and then click Open to open the new project
    • Be sure to click any link that comes up to connect the Project to Gradle, otherwise it may not be connected to Gradle properly.  
  • Android Studio may tell you that the Project is missing its "VCS root" when it opens it - be sure to click the link that tells Android Studio to connect the VCS root automatically.
  • The README tells you to run gradle testDebug in an Android Studio Terminal Window in order to see the test results.

Nonfunctional requirements

Specifically, complete the code in the various Java source files within the src folder. Look in the Android Studio TODO view for sections marked as TODO or FIXME and use the test cases as your guide. Besides other minor tasks, the main implementation tasks are:
  • Implementing the Count, BoundingBox, and Draw visitors
  • Implementing the missing classes Stroke, Outline, Point, and Polygon
    • The Stroke decorator indicates the foreground color for drawing its Shape.
    • The Outline decorator does the opposite of the Fill decorator: it indicates that its Shape should be drawn in outline (default) mode.
    • A Point is a Location without a Shape. You should implement it using a Circle with radius 0 as its Shape and override any methods as needed.
    • A (closed) Polygon is a Shape defined by a list of Points; the last Point should be connected to the first one to close the Polygon. Implement it as a special case of Group.
You must not make any other changes to the code skeleton or the test cases.

Grading

  • 0.5 code skeleton intact
  • 0.5 generated JavaDoc (in Android Studio: Tools > Generate Javadoc - use the defaults)
  • 1 Count
  • 2 BoundingBox
  • 2 Draw
  • 1 Stroke
  • 1 Outline
  • 0.5 Point
  • 1 Polygon
  • 0.5 output from running your app on an emulator or real device should match the drawing shown in the link in the Functional Requirements section above
  • Deductions of up to 1 point for
    • late submission of project (0 points if more than 2 days late)
    • modifications of Test... programs to make them pass
    • inability to run the app (eg, app throws an exception)
    10 points total

How to submit

As the first step in working on this project, you or your teammate will import the code skeleton into a private Bitbucket repository shared among the two of you and your instructor and TA. The name of the repository is cs313413f18teamNp3, where N is your team number found in Sakai, and the p3 part refers to Project 3. When your work is ready to be graded, please notify your instructor and TA via Piazza.
Comments