Construct classes from the outside in

When experimenting with the design of a new class, it's very helpful to approach the task from the point of view of the caller: Much of design is summed up simply as: The critical step seems to be the second. The best techniques are those which discover the errors the fastest. Coding "from the outside in" seems to perform very well in this regard.

Constructing a non-private method from the outside in might involve these steps:

In effect, such techniques use the programming language itself as a design tool.

See Also :
Use a testing framework (JUnit)
Use javadoc liberally
Separate public and private members
Design by Contract
Would you use this technique?
Yes   No   Undecided   
© 2014 Hirondelle Systems | Source Code | Contact | License | RSS
Individual code snippets can be used under this BSD license - Last updated on September 21, 2013.
Over 2,000,000 unique IPs last year - Built with WEB4J.
- In Memoriam : Bill Dirani -