Writing method stubs

Writing method stubs is a well-used technique for laying out the structure of your program before finishing all the required coding. It is very useful in a test-driven framework because it allows you put enough pieces in place to get the program running before everything is complete. Just like a builder can put up framing for a house and get the roof in place before having all the interior walls painted, electrical wiring done, etc. Imagine you are writing a complicated application that uses classes as variables for other classes... stubbing out methods allows you to create the class files required to get the class design implemented and tested before all of the code is written.

A stub is just a short version of a method. For example, consider the equals method stub below:

public boolean equals (Object o) {
    /** STUB/TODO: if o is null, return false; if o is not the same class as the current object, return false; recast o from Object to this type; compare property a and b, if they are equal, the objects are equal */
   return true;
}

You can see in the current form that the method will always return true. It isn't working correctly, that is, determining if two objects are equal, but it is working correctly in the sense that it is returning a boolean, which will allow your automatic testing to pass.