[plt-scheme] contracts.ss: Can you disable them at runtime?

From: Joe Marshall (jmarshall at alum.mit.edu)
Date: Thu May 17 18:17:59 EDT 2007

The change management software I worked on had test cases in the
shipped deliverable.  If the client couldn't connect to the server, it
would print out this:

    Couldn't connect:  http://localHost:7999/
    Check your .csf-prefs file.
    This can also be caused by a temporary network problem.
    In this case, simply re-issue the command.

    Your request was not serviced.

    Use the client_self_test command to check client settings.

The client_self_test command would do something like this:


  ChangeSafe client self-test.
      os.name: Windows XP
      java.vendor: Sun Microsystems Inc.
      java.version: 1.6.0_01

      User name is jmarshall
      Your home directory is C:\Documents and Settings\jmarshall
      Current directory is C:\Home\Jrm\workspace-a\java\cm\

      .csf file found at C:\Home\Jrm\workspace-a\.csf

      Time zone is America/Los_Angeles
      Daylight savings is in effect.

      File system agent protocol version: 1

      Preferences will be read from .csf-prefs in the same directory
as class CM file.
      No user preferences file (C:\Documents and
Settings\jmarshall\.csf-prefs) found.
	  CHANGESAFE_SERVER_URI = http://localHost:7999/
"C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\touch.exe" -t

  Success:  File modes will be correctly set.

  Failed: java.io.IOException: Cannot run program
""C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\touch.exe"": CreateProcess
error=3, The system cannot find the path specified
  WARNING:  Failed to set file timestamp.  Check value of

  End of ChangeSafe client self-test.

There were further commands that would test the connection and
instruct the server to run tests.

These tests were *amazingly* useful to us, but our customers loved
them as well.  They would run these self-tests before submitting bug
reports and send the output along with the bug report (anyone who
fields customer support complaints will tell you how wonderful *that*
is!)  We had logging diagnostics that were intended to be `turned off'
at the customer site.  We never turned those off, either.

If you have tests, assertions, and contracts that you `turn off' when
shipping, then the code the customer gets is *not* the same as the
code you use in-house.  It may be your intention that it be, but you
probably intended to ship bug-free software, too.  In a complex
system, you should ship *exactly* the same bits to your customer as
you use in-house.

On 5/17/07, Shriram Krishnamurthi <sk at cs.brown.edu> wrote:
> > Long:  Tony Hoare once said that assertions are like life vests. Why
> > use them on land during practice and leave them back when you go to sea?
> This is a poor analogy.
> I bet you turn off test cases, too, in software that you ship.  Why?
> Shriram
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.