Two Reasons a Project Will Keep You Motivated
I recently came across this post on HN about a little chrome plugin you can use to block your internet access until you are done writing some code. It's very true that the internet can be an easy distraction when trying to get some work done and the little plugin is a nice little tool to assist with that. When I really want to focus on something I typically turn off all my instant messengers, put my phone on silent flip it over and start hacking.
However, I got to thinking about what kind of projects keep me motivated, I find there are two reasons I'm generally motivated to work on any project:
Genuine enthusiasm to see the product/service/app work.
Learning something new.
There have been many projects I've started just because I thought they might be a good idea, but wasn't all too excited to work on them. These are the ones I kind of hack on for a little until I find something I get really excited about. They usually end up dying and not really going anywhere. The ones I'm excited about, I can hardly wait to get home to work on, I cancel meetups with buddies and would rather stay home Friday night to work on the project rather then go out. This happens naturally, there are no gimmicks involved, I just go.
What happens now is that I generally avoid working on projects I'm not excited about all together. Working on something just because you think it may make money takes a lot of the gratification out of the work, I find it's best to follow your instincts and focus on finding new ideas. I typically read lots of books and socialize more during these slumps as I know a the new idea is around the corner and will keep in my house for a month straight.
The other great thing to do then, if you're just out of fresh ideas and don't feel all too excited about working on any particular ideas that you currently have is to learn something new. Take your boring project and use it to learn a new language, a methodology, a new framework, etc. At least when you end up dumping the project after three weeks you still come away with something and it doesn't feel like a waste.
I recently came across this experience with two ideas I had. The first one was not something I was too pumped up to work on, but I used it to learn backbone.js and how to build RESTful APIs. A light bulb came on and I got excited about working on something new, which I've been working on non stop for the last few weeks. The original project is shelved, but at least I got to take my new found knowledge about backbone and REST with me to this one, which greatly speeds up my development.