Design and coding tips

In what follows, we provide some guidance on design and coding for your Android programs. Then, we list a grading rubric for each lab. As the labs progress we become more picky about good design and good code.

Design tips

Remember a program (classes, methods) should do one thing and one thing well. You should start to write good readable code from the start (see coding tips below). Break your programs into meaningful classes/methods. Be defensive when dealing with user input and other interfaces. Always check return values (a reference to an oject that might be null) and exit gracefully if an error has been encountered – IO failed – inform the user if needed in a meaningul way.

Keep the MVC (Model, View, Controller) architecture in mind when doing OO design for your Android applications:

Coding tips

Grading Rubric

For most labs we give out the apk solution so you should code to the solution behavior and what is detailed in the design document. However, here we breakdown the grading. Typically, labs are graded on completeness of the required features, the correctness of the functionality, and the robustness: note, if your lab crashes it will not be graded and you will have to resubmit a working version with 15% penalty against your lab grade.

MyRuns 1

We only consider correctness in this lab. Does the app work correctly as specificed in the design document and APK. (points out of 100)

MyRuns 2

We consider both correctness and well-written code in this lab. You should consider the design and code tips above as guidelines to designing and writting good code. 85% of the grade will be for correctness and 15% for style/well-written code. In terms of correctness: does the app work correctly as specificed in the design document and APK we have handed out. As the term progresses we will increase the point allocation to writing good code so start now (points out of 100)

StressMeter

We consider both correctness and well-written code in this lab. You should consider the design and code tips above as guidelines to designing and writing good code. 80% of the grade will be for correctness and 20% for style/well-written code. In terms of correctness: does the app work correctly as specified in the design document and APK we have handed out. As the term progresses we will increase the point allocation to writing good code so start now (points out of 100).

Note, we leave the design of the stress meter up to you but the description below hints at a decomposition that includes a launched main activity, a fragment for the stress meter grid view, a fragment for the visualization of the results, and a second activity for handling the case when the user selects a picture from the grid and then selects cancel or submit buttons. This is just one design you are free to design the stress meter as you wish.

MyRuns3

We consider both correctness and well-written code in this lab. You should consider the design and code tips above as guidelines to designing and writing good code. 80% of the grade will be for correctness and 20% for style/well-written code. In terms of correctness: does the app work correctly as specified in the design document and APK we have handed out. As the term progresses we will increase the point allocation to writing good code so start now (points out of 100).

This lab is focused on implementation of a database of Exercise Entry objects. The actions are to write, read and delete exercises from the database. The UI work is simple based on prior assignments. As discussed in class you have to off load the read and write database operations to background threads. Note, you do not have to do this for delete but feel free to do that if you wish (+5/100 for extra credit if you do the delete).

MyRuns4

We consider both correctness and well-written code in this lab. You should consider the design and code tips above as guidelines to designing and writing good code. 80% of the grade will be for correctness and 20% for style/well-written code. In terms of correctness: does the app work correctly as specified in the design document and APK we have handed out. As the term progresses we will increase the point allocation to writing good code so start now (points out of 100).

This lab is focused on implementation of of Google Maps, location manager, tracking service, broadcast receivers, and notification. A number of the key components in many Android apps. You have to integrate this into your existing MyRuns3 design based on the design spec.

MyRuns5

We consider both correctness and well-written code in this lab. You should consider the design and code tips above as guidelines to designing and writing good code. 80% of the grade will be for correctness and 20% for style/well-written code. In terms of correctness: does the app work correctly as specified in the design document and APK we have handed out. As the term progresses we will increase the point allocation to writing good code so start now (points out of 100).

This lab is focused on implementation of of the activity classifier. Your application needs to automatically infer standing, walking, and running human activities. It needs to reflect the activity state on the map in real-time. The activity inference should be reasonably accurate -- note, the more training you have say couple of minutes for each state the more accurate your classifier will be. Finally, does your application implement voting correctly so that the retreived activity state represents the majority activity state over the complete exercise.

MyRuns6

We consider both correctness and well-written code in this lab. You should consider the design and code tips above as guidelines to designing and writing good code. 90% of the grade will be for correctness and 10% for style/well-written code.

This final lab (hurrah) is primarily focused on the implementation of the backend (aka cloud) service. The final project implementation, however, consists of both app and backend components discussed in class.

The user uses the sync button to synchronise all exercises in the local SQLite database (assuming they exist) with the cloud's datastore. The user can add and delete entries on the phone -- as normal, then click on the sync button and the datastore (as viewed via the web browser app) is consistent with the app's local database. Similarly, the user can delete entries using the web app and the phone should reflect that change immediately -- meaning that the when the user removes an exercise from the datastore via the web app then that entry is also removed from the local phone database.

Note, you will be asked to demonstarte you complete MyRuns application in this last lab. You will demonstaret the functionality (discussed in the bullet points below) as part of getting your grade -- this is therefore a manatory demonstartion of your complete app and backend. How cool!

You will be asked to meet in the lab (we will Piazza the time). Go for a walk around the Green using the automatic mode. The you will return to the lab and demonstate the functionality.: