I worked as an undergraduate teaching assistant for intro programming classes at my school, and the amount of debugging (as that's what it is) that goes into designing a good assignment is extraordinary. We had a small collection of world-class teaching professors, and each time a new assignment was introduced, there were always problems. Some starter code didn't work for students A-E. Or a requirement was so ambiguous that solutions varied in a material way.
Like everything else, writing a really excellent assignment is an iterative process. After two or three offerings, you finally have something your users (ie, students) really value: an assignment that teaches well.
And to be honest, the presence of cheating on programming assignments never made any sense to me. It's so simple to detect plagiarism: you have the source right there (and a database of all previous submissions). I really do think that CS stands out among the classes for plagiarism because of how much easier it is to spot rather than an unusual incident rate.