On Sun, 02 Dec 2001 18:03:12 -0500, Panu Viljamaa <panu / fcc.net>
wrote:

>Yes I have. What happened was I find it hard to understand how to use a method written by someone else when there is no indication of what kind of arguments should be passed to it.  It is also hard to say if it is right or wrong when there is no clearly written contract on "what it should do".  This might be specified by some test-case-class somewhere, but I'd rather have 'contract' of the method visible as soon as I view the method's source, so I don't have to go test-case hunting.

The usual Smalltalk convention is to write a method defintion like
this:

  insert: anObject into: aCollection

which means about the same thing as

  void insert( Object o, Collection c)

The name of the method, insert:into: is chosen to reflect what the
method should do.

Was the code you wrote and read using those conventions? What language
are you using that expresses contracts? Eiffel?

Ronald E Jeffries
http://www.XProgramming.com
http://www.objectmentor.com