You are not your code
At my first job out of college, It was normal to hear someone exclaim out of frustration when they ran into some poorly constructed code. Most developers on the team were quick to throw out disclaimers on how they have never touched that part of the system, while the CTO was usually quick to volunteer "Oh I bet I wrote that, I write shitty code, feel free to delete it and write a better version". This was shocking to me, at this point, his years of experience as a developer was higher than my age but he exercised no pride towards his programming knowledge or prowess.
At that time, the worst thing you could say to me was that I wrote shitty code.You could abuse me or call my family names and it would not get to me as much as that would. I was privileged to learn how to code and build my first website when I was 14 and transit that to a full-time career. I started coding because I love to create things. Quickly I realized it could also pay the bills, which gave me more motivation and then writing code became part of my identity...similar to the way car enthusiasts feel that the car they drive tells you about them, I started to measure my self-worth by what people thought of the quality of the code I wrote. I then developed the impostor syndrome. I dreaded code reviews and sometimes I dreaded working with other people when I knew I did not have time to go through my code and revise every line before checking it in. I always worried that my code was not good enough, that I would be found out and was never excited to share it.
After a bunch of failures, where I got stuck and struggled to finish a project because I got burnt out or sat on a problem when my teammates could have given me the answer in a matter of seconds. I learned the hard way how essential it was to share my code with other people and get their feedback. I realized it didn't matter if it was finished, if it was refactored, if it was commented, sharing your code with other developers is the quickest way to improve your coding. Failing to build a support system and thinking you can soldier through all the difficulties in software development by yourself is one of the quickest ways to get disinterested in software development.
You are not your job, you're not how much money you have in the bank. You are not the car you drive. You're not the contents of your wallet. You are not your fucking khakis. ~ Tyler Durden (Fight Club)
My mistake was thinking that the quality of my code was a measuring stick for my self-worth and thereby putting a lot of pressure on myself to be great at it but at the same time preventing myself from doing things that would lead me to be a great developer. The CTO's approach to staying humble and realizing that no matter how much experience he has there is still room to learn put my mindset into perspective and I quickly learned to ask for help as soon as I am in need. I learned to surround myself with people I can learn from, people that are smarter than I am and people I do not agree with because it is the quickest way to learn.
I now welcome constructive criticism to my code with open arms and will easily admit to anyone that I am a shitty coder, because learning what I can do better from friends has saved me an incalculable amount of time in my quest to create better software products.