How to make programming lectures more effective and stimulating? I've been assigned the position of Teaching Assistant for the programming part of my university courses in Bayesian Inference, at the MS level. I previously taught a course, a few months ago, in Computational statistics. My experience doing this, with no previous teaching experience, has been not so great because of generally poor student's performance, probably due to a lack of familiarity with the programming language used (R). 

I am preparing slides lecture by lecture, with embedded code that I run and comment upon on-the-go. Occasionally I propose exercises but execution is often sketchy and I find many people cannot use the basic constructs of the language with enough fluency to create code that runs "on the spot". Given that I have a program to cover and I would not know what else to propose to the students other than exercising more and studying the syntax of the language -- I am, myself, in most regards self-taught about this, meaning that my programming abilities have little to do with the coursework I did during my studies -- do you have any advice on how to make my lectures more effective and stimulating?
Re: The desire for in-class exercises (code "on the spot") -- One thing I've discovered this semester (teaching introductory C++ out of the Gaddis textbook) is the idea of laboratory exercises with mostly filled-in programs, where the students only need to add a few lines involving the new language structures that you just lectured about. Compared to "write a whole program right now" exercises that I'd used in the past, this goes down remarkably well; fits in the right time slot for everyone, gets their hands/eyes to have typed that structure at least once, raises up the salient points/difficulties of exactly that one topic, etc. 

The fill-in lab exercises I'm doing come directly from the Gaddis instructor materials, so that eases my workload a lot. Frankly, I wouldn't have expected them to work as well as they do, but every day there's an important teachable moment that emerges organically. Not a silver bullet for everyone, but it's kind of been a revelation this semester.