If you have never read the 7 Habits of Highly Effective People you should do so.
Come back when you have finished.
If you have ever read the 7 Habits of Highly Effective People Steven Covey writes about when you should stand your ground and when you should give way.
Over the years I have found that the same thing also applies to code. There are times when I have had a problem and I am sure I can fix it if I just spend five more minutes working on it.
Five minutes turns into hours, which can turn into days. Meanwhile who is paying the bill?
Of course you cannot simply walk away from the problem, after all if you are not fixing someone’s problem, why are you writing that piece of code?
But sometimes you simply have to pick your battles. If the solution you are trying is simply not working then walk away. And I mean literally get up and walk away. If I am a bit stuck I find that physical distance can also give me mental distance.
When you get back to your keyboard then there is a good chance you will see the problem from a different angle, and maybe you will have found a different battle you can win.
Do you have a strategy for problem solving? What battles have you won and lost when writing your code? I would love know so why not leave a comment?