Watch this video introduction to Metacognition and Self-Regulated Learning
Effective debugging strategies draw on the cycle of Self-Regulated Learning.
When you write the code, you should have some idea of what it's supposed to do
When you test the code, you should observe whether it actually does what it's supposed to do
And when you make changes to your code in the hopes of getting it to work as it's supposed to, your changes are more likely to be effective (or at least help you get closer to a fix) if they are based on the observations you made while testing
When helping a student debug, it can be useful to articulate this cycle explicitly so that they can be intentional in their debugging. When you are trying to teach a concept or help a student with an assignment and it's not going as well as you had hoped, it can be useful to remember this cycle as you try to adapt your approach.
Of course, the applications of Self-Regulated Learning are not limited to teaching or learning Computer Science.
If you are not getting the grades you want in a course, simply continuing to work and study the same way is unlikely to produce a significant improvement. Sometimes the problem was that you didn't spend enough time, but pouring more time into the same approach won't automatically give you better results. Using your knowledge of yourself to come up with a new plan, trying out that plan and observing the results, then making adjustments and trying again until you see an improvement is more likely to find a sustainable practice that produces the desired results.
The same is true with interpersonal interactions. Observing, reflecting and making adjustments, and trying again is at the heart of cultivating rewarding relationships.