Empathize with students who struggled to get their code working, these students may not be ready to think about how to advance the design of their program; suggesting they refactor their code immediately after it finally runs can be discouraging.
Suggest students study an hour a night Monday through Friday as opposed to five hours in a row over the weekends, to help your students create good study strategies and prepare them for success in your course.
Remind students that each problem relies on a specific set of knowledge; not understanding a particular problem doesn't mean they’re stupid, it’s an opportunity to work hard and learn more.
Give students a fully functional program on Day 1 that they will incrementally add features to as you cover content throughout the semester to engage them by satisfying their desire for creating working code.
Give students guided notes (i.e., partially-completed notes that students complete) to help them stay engaged and learn from lectures or readings. It may be especially helpful to include vocabulary lists.
Help students see that they’re building basic understanding over the course of the semester that will turn into wider understanding since they may become frustrated with their perceived lack of progress.
Rather than taking away points, have students with sub-standard code improve it to better simulate how actual software engineering works.
Make the minimum requirements of an assignment worth a B to encourage students to push further for an A.
Show students the final version of a project with multiple steps to motivate them and give them perspective.
Incentivize good behavior for Effort, Participation, and Altruism by awarding a small number of points at the end of the course in order (enough points to bump students up a half a grade) to maintain an good classroom environment.