Students face several difficulties in introductory programming courses (CS1), often leading to high dropout rates, student demotivation, and lack of interest. The literature has indicated that the adequate use of gamification might improve learning in several domains, including CS1. However, the understanding of which (and how) factors influence gamification’s success, especially for CS1 education, is lacking. Thus, there is a clear need to shed light on
pre-determinants of gamification’s impact
. To tackle this gap, we investigate how user and contextual factors influence gamification’s effect on CS1 students through a quasi-experimental retrospective study (
N
= 399), based on a between-subject design (conditions: gamified or non-gamified) in terms of final grade (academic achievement) and the number of programming assignments completed in an educational system (i.e., how much they practised). Then, we evaluate whether and how user and contextual characteristics (such as age, gender, major, programming experience, working situation, internet access, and computer access/sharing) moderate that effect. Our findings indicate that gamification amplified to some extent the impact of practising. Overall, students practising in the gamified version presented higher academic achievement than those practising the same amount in the non-gamified version. Intriguingly, those in the gamified version that practised much more extensively than the average showed lower academic achievements than those who practised comparable amounts in the non-gamified version. Furthermore, our results reveal gender as the only statistically significant moderator of gamification’s effect: in our data, it was positive for females, but nonsignificant for males. These findings suggest which (and how) personal and contextual factors moderate gamification’s effects, indicate the need to further understand and examine context’s role, and show gamification must be cautiously designed to prevent students from playing instead of learning.