There's so much about programming that is incredibly satisfying and empowering. But it doesn't change the fact that, for me, programming builds an acutely negative mindset over time. I'm always asking the question "what's wrong with this?" Positive people are always focusing on "what's good about this?"
As soon as I saw it, I immediately sent the following back to him:
We can't spend our lives mired in depression by seeing everything we do as imperfect. Nothing is perfect. Especially with our "programmer's eyes" for technical detail, we will almost never achieve a level of quality that we would consider perfect. In fact, I would be worried if we did achieve perfection with any regularity.
Instead, if you start to feel the same way as Myles did, take a step back, and a deep breath. Stop looking at your code base, and start looking at your usage metrics. Look at all of the people using your code. Deriving value from your code. Improving their lives because of your code. If you don't have access to that information, ask for it! Validate that your "bug-riddled mess" is actually helping people do something they want (or need) to do. Seeing this will help fuel your creativity, and drive you to provide ever better solutions.
Take some time to connect to your users. They are your best defense against the negative subtext that we operate in. View your work through their eyes, and see how they derive value from it. It's a powerful thing, knowing you are improving someone else's life -- and we get to do it every single day. How lucky are we?