Assignment 1 Post-Mortem:
The following things make the TA a grumpy panda:
- Including package statements in your java code
- Directory names with spaces in them.
- Using more than one directory to upload your assignment
- Using really long file and/or directory names
- Guessing which file is an answer to which question
- Uploading all of the files and directories associated with a GUI project (NetBeans, Eclipse, ...)
- Comments in source who are so long they wrap
- Sloppily formatted code
Marks will be docked from your overall score on assignments 3 and 4 for most of these.
(Spelling mistakes excluded. We all make mistakes here and I know english isn't everyone's first language.)
General Observations:
- Do a final compile-and-run check on Moore/Mills before submitting code. Code that doesn't compile or run (question 1 only) gets 0.
- "But it was so easy to get my code to run. All you had to do was [X]." Sorry, no. You're in university now. You have to kick it up a notch. (Think about your future employer. They'll act this way too.)
- Don't hand in .txt files when compilable .java files are required.
- Test your code.
- Be really careful with your array bounds. If you declare MyArray[10], it's indexes are 0, 1, ...9. If you access MyArray[10], you will get an out of bounds error.
- One technique to consider adding to your bag of tricks is declaring your array one larger than you normally would so you can access indexes 1..n. For example, declare MyArray[10] as MyArray[11] and use 1..10 as the indicies. (The 0th element is ignored.) Note: This is for your information and is NOT REQUIRED for the course.
- If you use this technique, it is best to write in a comment saying so.
- Be sure you understand what variants and invariants are:
- A loop variant is a value who decreases on each iteration of the loop. It shows the loop will eventually end. A constant or increasing variant is wrong. Note that a standard invariant for a loop like: for (i=1; i< 100;...) is 100 - i.
- An invariant is something that is true when the loop begins. It can be something as simple as the size of an array being constant to something much more complex.