Let's be honest. We all write bad code.
Sometimes, we write absolutely shocking code.
In the programming community, we have an obsession with "good" code – and it's not difficult to see why. Good code is objectively better than bad code. It's faster, cleaner, more maintainable – Why would you settle for anything less?
Because we can't always write good code – Sometimes there isn't time. Sometimes there's legacy code. Sometimes the code was good when we wrote it, but the requirements changed.
Sometimes we just don't know how
Good code is an ideal – something we should all aspire to, but bad code is a part of life. Writing bad code isn't shameful. Writing bad code doesn't make you a bad developer.
The only thing that's shameful is never trying to write good code at all.