[CS Dept logo]

[back] Com Sci 221 Programming Languages: Lab Technique

[back] Department of Computer Science
[] The University of Chicago

Copyright information

Last modified: Mon Sep 25 11:48:38 CDT 2000


This course is about concepts, rather than techniques. But it is important to learn good CS laboratory technique, and there is no particular course where we teach it. Different lab technique is appropriate for different types of projects, but there are several techniques that are widely useful, and I will insist on two of them for Com Sci 221:

Version Control with RCS


It is very easy to make little blunders when editing programs, and even textual documents. Use RCS (Revision Control System) to help organize a sequence of versions of each file that you edit. For the future, you should never work on a significant file under Unix without using RCS. RCS saves a complete history of changes to a file, in a convenient form for comparison and backing out of errors. To start:

  1. Whenever you create a new directory in which to work, create a subdirectory named RCS.
  2. Whenever you create a new file by direct editing, check it in to RCS by executing the command ci -l filename. You will be (You don't need to check in for files that are created automatically by a compiler or other translator).
  3. Whenever you edit a file, check it in again with ci -l filename.
  4. To get a rough idea of what's going on, try ls RCS, rlog filename, rcsdiff filename.
  5. When you get in trouble, learn about the useful features of RCS. Start with man rcs, or info rcs.


On your own initiative, you may choose to use the more advanced, and more complex, CVS (Concurrent Version System) that is built on top of RCS.
Packaging files with shar
shar (shell archive) provides a convenient way to send a group of files, either in one directory or in a hierarchy of subdirectories. shar is the required format for submitting homework through email in Com Sci 221. To create and send a shar archive:

  1. Go to the directory containing the files you want to send, and execute shar filename1 ... filenamen >archivename.shar. If you want to send all files in the given directory, shar * >archivename.shar is a handy abbreviation.
  2. Include the file archivename.shar in your email message, as the entire body of the message. The way to do this depends on your mail interface.


For Com Sci 221, you will send shar archives to me. In order to test your technique, and to use shar for other purposes in the future, you need to unpack archives as well:

  1. Receive email containing a shar archive. The archive is plain text, and you can see what it is by looking at the beginning of the message body.
  2. Go to the directory where you wish to unpack the shar archive (for test purposes, this should not be the same directory in which you created the archive).
  3. Find out where the file containing the email message is. This will depend on your mail interface. You may wish to move it to your unpacking directory for convenience.
  4. Execute unshar message_filename.


unshar strips off mail headers and does everything necessary to unpack the archive into the same constituent files with the same names from which it was created. The beginning of the archive contains instructions explaining how to unpack the archive without using unshar, in case your system doesn't include the unshar command. As long as you can execute unshar, you may ignore those instructions.


Maintained by Michael J. O'Donnell, email: [] odonnell@cs.uchicago.edu