Motivation in general
There are plenty of books about motivation. How to motivate yourself and others. We give ourselves something we like after finishing a difficult task. It can be a chocolate bar or an hour of video gaming. We try to motivate out employees with many benefits: free healthcare, informal Fridays, pizza days, in-house conferences etc. At the beginning it works quite fine, but as we go the effects are weaker and weaker.
Motivation can be intrinsic and extrinsic. Intrinsic motivation occurs when we don't need external stimuli to get up and do what we planned to. We find those activities enjoyable, fun and exciting. In opposite extrinsic motivation pushes us do certain things because want to achieve what comes after. Win an award, scholarship etc.
Motivation and gamification
Gamification concept comes from video games industry. The whole idea is to improve user engagement in specific context. It can be video games, learning (Coursera,Udacity), working (Call Center). Now even Visual Studio IDE has it (ref) it implemented - so even programmers are affected!
Most research confirm gamification working.
I feel watched by Big Brother
Although gamification works it is still extrinsic motivator.
What helps me to be motivated in log run is tracking the activity progress. Leaving the office with thoughts in mind, that I made progress today, is one of the best feelings. This keeps me really motivated. I feel my work was not a waste of time. I can also make plans for future steps in the project. I just see the progress!
On the flip side no progress is a great demotivator. Wien we are stuck with a silly compiler error and we waste whole day to find a typo in code... We want just to go hope and forget about today.
Similar pattern arises when we wait for something, e.g. holidays. We are getting more excited and energized when the due date is closer.