I've always thought programming classes should start with reading and understanding a program that has some loops, assignments, etc. Maybe a program that draws some shapes or parses/prints some strings. Then have students modify it some. Then afterward, start writing your own stuff from scratch.