With more experience comes more wisdom. It's likely the other person has had a similar problem before.
There's also the real issue of being "too close" to the problem. You've been staring at the same thing for so long, you can't even see the missing semi-colon, for example. I've worked on things for hours, only to realize I needed to replace the equals sign with a colon, because it was a difference context. And vice versa.
How do you not feel bad about it? Well, at first you do feel bad. That's simple human nature. You have been programmed by schooling, parents, retail sales, and lots of other things to believe you need to always have the right answer the first time. The "real world" doesn't work like that, especially when it comes to computing. The average programmer fails more times than they succeed. This comes from the simple idea that you only succeed at a task once, but you can fail at it many multiples of times and in many different ways before it finally works. And even then, there's probably a better way to do it. (I can't even type this answer without having to correct my spelling and grammar.)
The longer you do this type of work, you'll realize that it's not your failing, it's just another experiment in not being 100% correct. You learn to brush off your failures and keep going. I find that when people point out something I've been missing, I'm relieved. I no longer have to beat my head against the problem. I sometimes still feel stupid for not noticing the extra comma in my List
, but I fix the issue and forget my mistake. I try to just remember the solution, so I don't make the same mistake again.
As a junior, I've found solutions that seniors couldn't. I've completed tasks in 1/4 the time others have. I've also spent days trying to figure out why my JSON doesn't work, when I should have been using "
instead of '
. Grrr!
I've been learning programming for over 25 years and have been a professional for around 7 years. I'm still learning. I learn new ways to perform functions, write cleaner code, how better to debug code, and how what I think works best doesn't matter to some people.
The key is to not beat yourself up for "failures", since they likely aren't actually failures. It can take a while to learn how not to take it personally, but believe me, it's usually not personal. Even when someone blames you, it's probably their ego you've just insulted rather than it being your fault. Well, unless it really is your fault, but that's not the case this time.
And sometimes you just need a little sugar intake to make you feel better. Eat a cookie and calm down a little. Yum, chocolate chip..... ;-)