Something I learned early on was the importance of stepping back and looking at the bigger picture.
A good developer improves this over time, but it's far too easy to get yourself neck-deep in code and lose focus of what's important.
As a measure, if I find myself getting stuck, what I like to do is go back to the basic level and ask "what is the purpose of this?" This may involve getting more information about the feature/bug, or just talking through different scenarios. I also look at the likelihood of a scenario occurring. Sometimes, you're spending time trying to solve something that nobody knows or cares about.
A good developer improves this over time, but it's far too easy to get yourself neck-deep in code and lose focus of what's important.
As a measure, if I find myself getting stuck, what I like to do is go back to the basic level and ask "what is the purpose of this?" This may involve getting more information about the feature/bug, or just talking through different scenarios. I also look at the likelihood of a scenario occurring. Sometimes, you're spending time trying to solve something that nobody knows or cares about.