Part of being a good programmer is knowing when you are writing bad code. In my mind its subtlety different, I never plan to write bad code, but sometimes it just turns out that way because of a tiny initial bad decision.
That is what sets good and bad programmers apart. Bad programmer have no clue that they are writing terrible code.