In my experience attitude and connections count for the most. I'm 45 and I don't have any problems finding new opportunities. But I never go through the front door, it's always a referral. I can't imagine having a real problem until I'm in my 60s. At least around here, there just aren't so many programmers that we can afford to turn away qualified people just because they are in their 40s or 50s. If they know their shit, they're welcome to work for us. We've got developers ranging from 20-65, pretty evenly distributed.