I've gotten an habit of seeing people complaining on how they were gradually losing motivation when working on projects, or seeing articles talking about "how to stay motivated" while working in development.

The thing is, even if my colleagues are pretty tolerant and comprehensive, which gives me a bit more time in case I'm not feeling well, or if I have other urgent matters, my work still requires me to produce some results, or at least provide clearness on how the projects I'm working on are moving.

Motivation is a bitch. That's the only thing to remember.

Motivation is nothing more than a mood, that can come and go following so many factors that you'd really have a hard time controlling it.

A lot of papers exists on "how to control it", giving advices such as exercising, being rewarding on yourself and such, and even if they really can contribute to maintain motivation, it's really counter-productive in the long run to rely on that wellness.

Discipline, instead, is not a mood, but a work habit.

In a way, it's forcing you to work, to track your work and to stay focused on the objectives that you want to achieve, no matter what.

Painful and annoying at first, it can quickly help you go further, providing better results and helping you even further on some other projects that you could start right with a good organization.

Some tips

Impose yourself some organization procedures. Kanban, those Agile methods and such are obviously the most complete and exhaustive ways of keeping track of some projects but if that's too overwhelming for someone starting (which is perfectly understandable), something as simple as making a list of steps and goals to achieve on the day, can already help you. It gives you precise steps you can hook yourself on and just follow, and if you feel lost, or if you're stuck on a problem, you still have a list of other tasks you can start right away, keeping that first task for later. Still, don't define too much tasks, or don't switch on every task without having finished some !

Don't be hard on you. That advice can also be seen in the "Motivation advices" section, because it's not only a "motivation or discipline method", but rather an over-looked common sense advice. Working one or two hours maximum before taking a small break can really let you rest in between, coming back with a fresh start on the problem, without having lost track of what you did before. Still, taking a 15min-coffee break every 30 minutes is obviously too much and could easily distract you !

If you're working alone, or don't have a strict workplace, define a clear work schedule, and stick to it. Having a clear separation between "At work" and "Not at work" will give you a period of time in which you can actually impose yourself the fact that you're working on x or y subject, and nothing else.

Impose yourself some work methodologies, especially for pet-projects and side-projects. Imposing yourself a "work rhythm" and guidelines which you must follow can help you define and organize goals and plans. Specifications, drafts, diagrams etc. are tools you can use to put on paper the concrete definition of objectives, changes and choices you'll take for the evolution of your projects.