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 object 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:

Please make sure that your submitted code has no warnings in the Android Java code or XML. We will not grade code that has compilation/lint warnings unless you have the OK from the TA in advance for some edge case that can't easily be cleared:

You should download, inspect and run all code examples in the notes (.zip files) to fully understand concepts and patterns taught in class. However, you cannot under any circumstances ``cut and paste'' these examples into your solutions for your submissions. You should use these coding examples as a learning tool; always code your own intrepreation of these coding examples in your solutions if you choose to use the patterns; that is, look at the code and understand how it works but always code your own versions of these patterns if you use them in your solution:

MyRuns 1

Note, MyRuns is a single user app. You do not have to design for multiple user registration in MyRuns1.

We only consider correctness in this lab. Does the app work correctly as specified 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 writing 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 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)

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.

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. 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 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, getting location updates, tracking service, activity recognition, broadcast receivers, and notification. Note, your service has to offload the processing associated with locations and activiy recognitions from the TrackingService (which actually runs on the UI thread). These worker threads do the processing and inform the MapActivity when information is available via broadcast receivers.

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.

MyRuns 5

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. 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 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).

CodeIts

We will have a number of (probably 3) short coding assignments called CodeIts. These will not be complex like MyRuns and just reinforce what we discussed in class (e.g., edge cases, finding bugs and fixing them, then testing to make sure no bugs exist).

We will grade CodeIts simply. We will only look at functionality -- does the app do what we asked.

Don't get stressed about CodeIts. They are more brain teasers. And fun.