From Code Generation to Logic Internalization: A Human–AI Collaborative Mechanism for Generative AI- Enabled Programming Instruction
To investigate the collaborative mechanisms of generative artificial intelligence in programming instruction, this study conducted a 12-week quasi-experiment with 80 higher vocational students. The experimental group used AI assistance, while the control group relied solely on conventional search engines. The results revealed heterogeneous effects of AI usage, with significantly greater intra-group variance than inter-group variance. Three interaction patterns were identified—low-engagement copying, passive debugging, and active constructing—among which only the active-constructing pattern facilitated the internalization of programming thinking. Learning outcomes were optimal when the independent modification ratio was maintained within the $40 \%-60 \%$ range. Students who engaged in active error attribution demonstrated significantly better independent programming performance. Based on these findings, this paper proposes an “attribution- first” human- AI collaborative teaching framework to inform programming education reform.