I've never used it but I have heard good things about Etherpad. The teacher must install and tweak the software; for the students the experience is visiting just another web site (and editing stuff). You can turn Etherpad into an IDE with Plugins, e.g. ep_codepad and ep_syntax.
That is a type of Collaborative real-time editor.