Dear new developer,
Sometimes, you just have to stop. Stop writing that code. If you’ve been banging your head on a problem, stop. If you’ve been thinking about a bug, stop. If you’ve been writing and writing code but you can’t seem to get anywhere, stop.
Go for a walk. Take a break. Talk to someone. Stroll around your office. Take a few minutes to write up the issue.
All of these actions will let your brain take a break. This often, but not always, brings perspective and a new approach to the issue.
If the problem is really serious, you may need to let it simmer for a day or so. I can’t tell you how many times I’ve gone to sleep with a problem and woken up with a novel approach. Not a solution, but a new way of thinking about it that leads, eventually, to a solution.
So, throwing in the towel, for the short term, is actually a viable problem solving technique. Running repeatedly into a wall is often a sign you need to take a break.
Sincerely,
Dan