I felt obliged to comment because I feel I know what you are talking about and I also worry that much of the advice posted so far is wrong at best, dangerous at worst. I am 42-year-old very successful programmer who has been through a lot of situations in my career so far, many of them highly demotivating. And the best advice I have for you is to get out of what you are doing. Really. Even though you state that you a…
This is probably true. If you're happy with what you're doing, you're probably (but not certainly) going to be better at it than someone who isn't happy with it, all else being equal.
However, being happy with one's job is not a reasonable goal for most people. Or, to phrase it a little more flagrantly:
The idea that we need to be happy with our jobs is bullshit.
Among the programmers I know, many of them claim to love programming enough that they're happy to do it full time (AND work on side projects!) -- and to them, earning a paycheck is almost an afterthought; it's a nice side effect. The amount doesn't even really matter to them all that much because programming is just so much fun. (This is not a straw man -- I've personally listened to employees at Facebook, Google, and various Silicon Valley startups express this very notion.)
These claims are not easily proven true or false, but I suspect that most of them are false. I think that if a programmer represents himself as anything other than absolutely in love with programming, then they lose a competitive edge.
The truth is, I think, that programming is just a job. It has it's ups and downs, and it's certainly less terrible than many other jobs. Like most jobs, you'll be given tasks that you can't get out of and you just have to learn to deal with.
Not being in love with your job is does not constitute a very serious situation. It's simply a necessary evil for most people.
Perhaps you're one of the lucky ones who likes his job that you do it from a "root of joy and excitement" on a daily basis. But I think such persons are quite rare.