Why the order of trying and asking could matter
The intuition behind "try it yourself first" is that the struggle is where the learning happens, and AI help afterward becomes a check rather than a crutch. The evidence is consistent with this idea but does not isolate it. A review of large language models in programming education reports that hybrid manual-AI workflows—where students work by hand and with AI—are linked to deeper understanding, better reasoning about algorithmic choices, and stronger long-term retention [2][5]. That describes a blend of independent and assisted work, not a strict try-first rule, so it supports the general shape of the practice without proving the timing is the active ingredient.
The systematic review adds a mechanism-level clue. It found that structured prompts, graduated hints, staged permissions, reflective interaction, and fading—designs that keep the learner doing more of the cognitive work—generally supported more active participation than unrestricted solution delivery, though effects on conceptual learning were mixed [1]. In plain terms, help that arrives as a nudge after you have committed to an attempt looks more promising than help that arrives as a finished answer. The review frames the real competence as "accountable control" over AI-assisted programming rather than prompt skill or successful code production alone [1].
Does the help actually stick after the session ends?
This is where the picture gets less tidy. In a study of computer science students doing C programming tasks, ChatGPT-assisted work produced higher coding performance, but retention was not significantly affected when measured at immediate and 48-hour intervals [3]. That is a short window—two days is not long-term retention—so it should not be read as proof that AI help fails to stick. It does show that better performance during the task does not automatically translate into better recall afterward.
The systematic review reaches a similar caution from a wider angle: generative AI more consistently supported immediate assisted performance, efficiency, feedback, and engagement than independently demonstrated learning, and evidence for delayed retention, transfer, and integrated long-term competence was limited [1]. So the honest state of the evidence is that assisted performance and durable learning are different outcomes, and the second one is much less well measured.
Transfer is the harder test, and it is barely measured
Transfer means using what you learned on a new, unfamiliar problem—arguably the outcome that matters most for coding. Here the evidence is thinnest. The systematic review explicitly notes limited evidence on delayed retention and transfer [1], and the ChatGPT study's abstract links AI assistance to weaker transfer and overconfidence as concerns observed in the broader literature rather than as its own measured result [3].
One reason transfer may suffer is psychological: the same study examined psychological ownership alongside load and retention, suggesting that how much learners feel the code is "theirs" may matter for how deeply they engage [3]. That is a proposed connection, not an established cause, but it fits the review's emphasis on verification—checking and understanding AI output—as what separates reflective co-programming from copying and accepting flawed code [1].
What a learner or teacher should take from this
If you want the practice most likely to help, the evidence favors making your own attempt first and then using AI in a checking, hint-giving, or debugging role rather than as a solution dispenser. That recommendation rests on designs that kept learners active [1] and on hybrid manual-AI workflows associated with better understanding and retention [2][5], not on a study that compared try-first against ask-first head to head.
Two practical cautions follow. First, judge yourself by what you can do without the AI, since assisted performance overstates independent learning [1]. Second, do not assume a good session means durable knowledge—the one controlled comparison found a performance gain with no significant retention effect at 48 hours [3]. Tools that add spaced repetition and adaptive problem scheduling are being built specifically to shore up long-term retention [4], which is a tacit acknowledgment that a single AI-assisted session is not enough on its own.
Sources used in this answer
Human–AI Co-Programming Competence in Programming Education: A Systematic Review
This systematic review found that generative AI more consistently improved immediate assisted performance, efficiency, feedback, and engagement than independently demonstrated learning, that structured hints and staged permissions supported more active learner participation than unrestricted solution delivery, and that evidence for delayed retention and transfer was limited.
A Review of Large Language Models in Programming Education: Implications
This review reports that hybrid manual-AI workflows in coding activities are associated with deeper understanding, improved reasoning about algorithmic choices, and stronger long-term retention, without specifying the timing of AI help relative to independent attempts.
Your Programming Students' Cognition with ChatGPT: Higher Performance, Lower Retention, and Reduced Ownership
In computer science students doing C programming tasks, ChatGPT assistance improved coding performance but did not significantly affect retention measured at immediate and 48-hour intervals, and the work raises concerns about weaker transfer and reduced psychological ownership.
My Code Weapon: Adaptive Problem Recommendation and Knowledge Retention Scheduling in AI-assisted Programming Education
This paper presents an adaptive programming education platform combining dynamic difficulty calibration, adaptive problem recommendation, and spaced repetition to support long-term skill retention in competitive programming.
A Review of Large Language Models in Programming Education: Implications for Computer Science Learners
This review reports that students engaged in coding activities or hybrid manual-AI workflows show deeper understanding, improved reasoning about algorithmic choices, and stronger long-term retention, without specifying whether AI help came only after independent attempts.
