Have students decompose problems in a more structured way by acting as project managers who need to build teams (of methods and classes) and divide the work amongst them in a clearly organized manner.
Teach students to use a system of inquiry, testing, and refining to debug their code, develop better coding habits, and deal with their frustration.
Lay out what good programming style consists of for your class to encourage good style and make debugging easier.