Design Checklist
Following is a non-exhaustive checklist of things you should think about
when you design programs.
- Do your variable names clearly indicate the type of data stored by the
variables?
- Do your class names clearly describe the functionality of objects of
the class?
- Do you use inheritance correctly and when necessary?
- Do subclasses have an "is-a" relationship with their respective
superclasses?
- Do you avoid repeating code by inheriting appropriate
functionality?
- Can you concisely describe the purpose of each class?
- Does each method perform one well-defined operation?
- Have you eliminated repeated code, for example by using loops or
defining a single method that can be called repeatedly?
- Do your classes contain constructors that appropriately initialize the
data members of the class?
- Do your methods return appropriate values?
- If you need to return two values from a method, do you create an
appropriate object?
- Do you appropriately avoid the use of magic numbers?
- If a variable is used only in one method, is it declared local to that
method rather than as a data member of the class?
- Do you avoid inefficiency by only creating objects when necessary?
- If you wish to declare a reference to an object but create the
object later, initialize the reference to null, not to a new
object that will be replaced later.
Sami Rollins
Date: 2007-09-27