|
The Java Language
|
CS 161 - Java |
- Putting all your code in main is a bad idea
- Try to write small (< 50 lines) methods that do
what their name implies: actions (verbs) that you want to be performed.
- Any time you find yourself writing the same, or almost the same,
lines of code (even if it is only a few lines), think about making
that code a method instead.
- Any time you can give a name for a sequence of lines of code,
think about making that sequence into a method.
- Think of objects: things (nouns) that can
perform various actions (verbs) that will be the object's methods.
- Try to think of collections of things each of which is independent
of other things in the collection.