java hosting


horsebig.gif (6904 bytes) drivehead.gif (2283 bytes) cowleft.gif

Common Nits Picked In The Past

This is stuff that people have done in the past that resulted in being asked to do it over.
This is by no means a complete list, but it does show the most common problems.

The homework must exactly meet the style guidelines.

By far, the most common problem during the first pass of the first assignment is not following the Style Guide.

   - spacing! - Section 1.2
   - indentation! - Section 1.1
   - braces! - Section 1.1
   - case! - Sections 2.1 and 2.3

Try to not declare a variable until just before it is used.

This isn't C.  See section 3.3 of the style guide for more info.

Try to initialize all variables when they are declared.

Again, a common problem with old C programmers.

Start loops at zero.

Start for loops at zero if you can.  This usually makes your programming life easier in the long run.

Use a for loop any time that you know in advance how many times you are going to do a loop

And in this assignment, you know in advance that you will write the name 100 times.

If you have a lot of computations inside of your loop that always come up with the same result, it would be wise to move that computation outside of the loop, store it in a variable and refer to that variable inside the loop.

Double check what the class name should be for the assignment.

Use the name of the assignment (also seen in the sentence "In other words, I want to type ...")

Don't add extra stuff unless specifically mentioned ( the KISS principle ).

You can easily make this program test for a million things and the program would be two million lines long.  But realistically, this program is for you to get a tiny amount of exercise using loops and, for the second half, math.  You don't need to test for multiple names, or if the name is too big.  You are the only person that will be running the program.  If you choose to pass in bizarre data, it is okay if the program crashes.

OOP is a great thing. But that doesn't mean it's the best solution for all problems. The important thing is good, simple, clean, readable code. In this case, adding object stuff just complicates things.



Page maintained by Marilyn de Queiroz