ObjectContract.toCommentString()

6 views
Skip to first unread message

Michael Ernst

unread,
Jun 11, 2016, 2:14:40 PM6/11/16
to Randoop Developers
The result of ObjectContract.toCommentString() is inserted in the source
code right before the code. I have some questions about the design of
this.

* Is this always necessary? For example, looking at IsNull and
IsNotNull, the comments seem more like clutter than useful documentation.
Should toCommentString() be permitted to return null in such cases?

* When there is a comment, should the one-line comment be sufficient to
fully explain the underlying problem to a programmer reading the code, or
should it just give the name of the Java class to help the programmer
understand what part of Randoop generated the code? (If the latter, then
ObjectContract.toCommentString could be final and subclasses of
ObjectContract wouldn't need to implement it.) Different implementations
of toCommentString() currently make different choices. I lean toward the
former, especially when it is the message in an assert statement. In
those cases, writing toCommentString right before the assertion which also
contains toCommentString seems especially redundant.

The documentation for get_observer_str and toCommentString should indicate
how they are different. Are both needed? get_observer_str seems to be
used only by getID which doesn't seem to ever be used. Can we get rid of
that dead code?

We should make a decision about all this, document it clearly, and make
all implementations (including those in Waylon's pull request) consistent
with it.

Thanks,

-Mike
Reply all
Reply to author
Forward
0 new messages