The stereotypical actor always wants to know this before performing a scene. Why am I doing this? Why is the character saying that? How did we get into this scene? The idea being that understanding what the character would be doing or saying in the real situation is helpful to making the acting seem real.
Over the years I've been a programmer (almost 30) I've generally been aware of what motivates me in projects, jobs and coding in general. Sometimes I know too well that my motivation gets me into trouble sometimes!
I have this desire to fix broken things, solve problems others abandon as too hard, and look for solutions no one else sees. I can look back at why I took certain jobs or contracts, why I started little companies, why I injected myself into situations where failure was almost assured, and even what technologies I became interested in.
What gets me into trouble is fixing broken things irritates the people who broke them; solving problems others abandon as impossible makes them look stupid, and seeing the solution that I know will work often is at odds with the status quo. Even though I generally get along with most people, there are some kinds of people who simply will hate you for doing better than they do, or even doing something different than they do.
Being motivated by these potential failures means you have to be ready and willing to suffer the failure if you can't succeed. Lots of people hate to fail and do anything to avoid it; often it's hard for me to convince them that I like taking chances and even arguing in favor of them despite the odds.
What doesn't motivate me is a daily grind, just filling out a box in an org chart, picking up my check, or working on a doomed project where there is no hope and I have no ability to change anything. I'd rather quit or work for cheap on something where I can be motivated and make a real difference. Sadly this motivation has messed me up financially more times than I can count!
I have way too many examples of how this strange desire to risk failure has affected me.
The best code I ever wrote came out of just such a situation. I worked for a consulting firm around 1999. We got a contract to build a web based product search site for Consumer's Digest (don't look for it, they never paid for it and it got pulled after 18 months). I wasn't involved in the project. Due to the ridiculously complex Automobile feature/package rules the previous firm had given up after 6 months saying it was impossible. A month before CD had promised the site would be up, our team was in panic mode as the average search time was 70 seconds on production hardware, and nothing they did made it go down. So I volunteered to come up with a solution. However I could not change the database, change any code other than the search feature itself, and the hardware was already purchased. Despite that I was able to figure out a solution, test it, write the code and insert it into the rest of the site with no database changes, and the average search time was well below a second. The site went live on time and was popular until we killed it since CD never paid up.
What's more there was never a single bug reported in the search code over the entire 18 months it was up. Under ridiculous pressure and impossible odds I made it work. It's not like that happens every time of course but for whatever reason this kind of problem kicks my motivation into high gear.
Later on I worked for a Financial services company (as a Software Architect) which had Java web applications to serve the customers as well as the field agents. For the prior three or so years before I started the Java programmers had been blamed for the terrible performance of the applications. The database backing these was the company AS/400 which that group said was really fast and self-optimizing so the issue had to be Java. Nothing the Java team said made any difference.
This bothered me for while before I came up with a way to prove what the issue was (which was clearly the database to the Java team). The AS/400 ran a version of DB2 which the Java applications used SQL to talk to, but the underlying data was managed by a non-SQL 4Gen tool. The Oracle DBA helped me out by cloning the production data into a compatible schema on an old PC running Oracle. I then wrote a benchmark Java application that communicated either with the Production DB2 or the wimpy Oracle PC and simply obtained a single row from each table in the schema while measuring the time. Low and behold the little Oracle PC ran rings around the production DB2 in some cases by an order of magnitude. I packaged up the code and the charts and sent them around to everyone that mattered.
The AS/400 DBA that had insisted there was nothing wrong with his hardware had no way to explain how an obsolete PC could beat his 6 million dollar baby, so he ran the benchmark Java application while we looked at the AS400 console. It turned out the DB2 was running in a 90MB partition on the AS/400 and every time it was accessed swapped memory like crazy. All of the companies 150,000 customers and 800 agents were sharing 90MB of RAM! So they admitted it was too small, upped the partition to 1GB and suddenly the unchanged Java applications ran like the wind. Problem solved!
Then the company went into politics as usual mode, made stupid decisions, created uselessly complex software methodologies and I couldn't stand it anymore and I found another job.
At my last employee type job at a healthcare claims processing company I was also an architect but when it came to deciding on how to replace the company's main software system I sided with the CTO who thought we should have a backup plan and not depend on a third party middleware system that was pretty skanky. I pushed this to the architecture team and they got so pissed at me I had to leave. They went ahead and worked on the new system using their plan for more than a year and it never worked. Eventually a new CTO came along and canned the effort, replacing it with a new system not too different from my backup plan (though I wanted to build it and this didn't exist at the time). So some vindication but I sometimes miss the great salary and 5 weeks vacation the company offered. There is always a downside to my motivation!
So just yesterday I turned down a promising job with a Silicon Valley startup basically since I don't believe in the product, the development is very rigid, and the potential for making a real difference seems negligible. Probably 3x the money I am making now, but at the game company I am at now I can and have made a difference, the challenges are (too) many, and I love the product.
I guess I am basically an idiot but too old to give up on what motivates me as a programmer. If I ever lose it and just cash a paycheck and stop caring I will quit programming.
Though it would be nice to make 3X the money again!