The idea is not to force students to do the right thing, but to get them to understand the differences between the better ways and the worse ways to write code.
All of these exercises involve maintaining or re-writing existing code written by other people.