Hands-On Perl provides an interesting solution to these problems. Instead of alternating lectures and labs, the lecture runs continuously. Each slide has an example on it. Students try out the example while the lecture is going on. The lecturer suggests changes to the example, and the students try out the changes and see the effects immediately.
Some slides have exercises.
Students work the exercises while the lecture is going on. Occasionally the instructor will pause to let the class finish trying an example. Students find it much easier to pay attention and learn the material when they are involved in what's going on instead of passively absorbing a lecture. Since the slide set is loaded on the students' workstations, any student can return to an old slide or skip ahead without disturbing the others. A typical outline for the class follows.