I need to create a small custom live system (for teaching a programming class). What would be the best way to do it?
If you want to build your own distribution, Try Linux From Scratch (LFS). It is a project that provides you with step-by-step instructions for building your own custom Linux system, entirely from source code. http://www.linuxfromscratch.org/
There are a lot of lightweight linux distributions available. Most of these can boot from LiveCD. http://lightlinux.blogspot.com/2008/06/top-10-of-lightweight-linux_24.html
You can use Remastersys  to build an Ubuntu or Debian distro of your own. For a fast live cd, I would install XUbuntu  into a virtualbox vm and install the necessary programs and set it up to your liking. Then you can run remastersys backup and burn the resulting ISO to CDs for your students. http://www.geekconnection.org/remastersys/remastersystool.html
This website is a list of all the Live CD distros with a ranking given by the users
I suggest you go with XUbuntu for programming purposes
If you are looking to use it for server tests try open SUSE http://www.livecdlist.com/frontpage?order=value_1&sort=desc
How about Morphix? http://www.morphix.org/ - includes a page on "Building a new LiveCD in two commands"!
You might want to take a look at TKLPatch , a simple (but powerful) appliance customization mechanism.