Automated assessment and immediate feedback are staple features of modern e-learning systems. In the case of programming exercises, most systems only provide binary (correct/incorrect) feedback, which is often inadequate for students struggling with the material, as they may need expert guidance in order to successfully overcome obstacles to understanding. We propose a Case-Based Reasoning (CBR) approach to improve the quality of feedback on programming exercises. CBR is a machine learning technique that solves problems based on previous experiences (cases). Every time the instructor provides feedback to a student on a particular exercise, the information is stored in a database as a past case. When students experience similar problems in the future, knowledge contained in past cases is used to guide the students to a solution. While the system will provide detailed feedback automatically, this feedback will have been previously crafted by human instructors, leveraging their pedagogical expertise.