|Do you know where your variables are?|
This ended up being a bit longer and with a bit more, well, hubris than I first intended. You was warned.
Happens to me all the time. Usually, I'll go back to some of the code I wrote a year ago, when I started this job, fix whatever bug or add whatever feature brought me there, and spend a few minutes looking over the code and thinking "Ugh! I wrote this crap?" Of course, when I wrote it I thought I was pretty damn good at this kind of thing.
When I started this job, I was afflicted with one of the most irritating flavours of hubris: Undergraduate Programmer Syndrome. I'd eaten all of the toy problems my profs had slung my way like they were popcorn. I'd normalized databases, tuned neural networks, simulated memory caches and proven algorithms to be NP-Complete.
To make a long story short, I was something of a dickhead.
After three or four months, my attitude changed. I was submitting code for peer review and brainstorming with my colleagues before sitting down to tackle a problem. I realized that most of my co-workers have about a billion times more experience than I do, and I'm trying to learn from them the easy way, not the hard way. I'm not (as) shy with the stupid questions, provided I've RTFM first. I've inhaled every perspective on good programming that I can find, from Code Complete to The Pragmatic Programmer to XP and beyond. I've gratefully listened to the senior programmer rant about test suites, the CEO rant about unnecessary complexity, my supervisor rant about revision-control systems, and the sysadmin rant about indentation style. I've come to the Monastery, and absorbed chromatic's test-suite fanaticism, tilly's blend of theory and practice, merlyn's great, elegant magic, and scores of other influential views and practices that I'll never be able to properly enumerate. I'm a better programmer than I've ever been.
And I still have a lot to learn.