Project 3

Due date: Monday July 11 at 11:55pm (updated due date)

Pair project

If you have not yet paired up with someone, please do so by June 20 at the latest!

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 => Java 8 lambda expressions
    • basic Android graphics
    • mock-based testing using Mockito

Description

In this project, you will complete the implementation of a 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. Please note that although I would prefer you to use GenyMotion as your Android emulator, it does not currently work on Windows 10.

Notes 
  • See below under How to submit for how to name your imported Bitbucket repository (this uses the standard course naming convention).
  • You can use Android Studio or SourceTree to check out your imported Bitbucket Project, not Git Bash on Windows
    • Be sure to click any link that comes up to connect the Project to Gradle, otherwise it won't be connected to Gradle properly (I was not able to get that to work when I used Git Bash on Windows, which is why I'm suggesting that you use Android Studio to do the checkout). You should be able to use the standard Gradle wrapper successfully (that's the default choice). 
  • Android Studio may tell you that the Project is missing its "VCS root" when it opens it - click the link that tells Android Studio to connect the VCS root automatically.
  • Simple ways to run Project 3 Unit Tests:


    1. If you are in the Project view, right click on test => java => edu...shapes and select Run 'Tests in ...' - that will run all 21 Unit Tests.
    2. If you are in the Android view, follow the README instructions to select Build Variant Unit Tests, right-click on edu...shapes (test), and again select Run 'Tests in ...' to run the Unit Tests.


    If you do either of these you won't have to find a version of gradle to run the tests, Android Studio will find it for you in the background.


    So far, I have not been able to get device tests to run for Project 3 by following the Build Variants recipe in the README file. To prove to yourself that your Project 3 works once you have gotten all the Unit Tests to pass, simply run the app on an emulator or connected Android device and check that the drawn image matches the one linked to above.

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 (Test-Driven Development). Besides other minor tasks, the main implementation tasks are:
  • Implementing the Size, 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 can implement it using a Circle with radius 0 as its Shape and override any methods as needed, or you can just make the Shape null.
    • 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 Points

  • 0.5 code skeleton intact
  • 0.5 generated JavaDoc (in Android Studio: Tools > Generate Javadoc - use the defaults)
  • 1 Size
  • 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
    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 between the two of you and your instructorThe name of the repository is cs313su16teamNp3 or cs413su16teamNp3, where N is your team number found in Sakai after June 20, and the p3 part refers to Project 3. When your work is ready to be graded, please notify your instructor via both Piazza and Sakai.
Comments