tldr: gamify your development process and jobify your gaming process. Get good feedback loops going for your programming so you can track progress. Count how much money you are earning for every hour of gaming.

Why is gaming more fun than programming? In my opinion, it’s because of 3 reasons:

1. The action-effect feedback cycle is almost instantaneous

2. Your long-term goals are well defined and easy to hold in your active memory(gear, skill spec, kill this boss etc)

3. The connection between those goals and your immediate actions is very clear. If you need 200k DPS to farm act whatever and you are at 180k then you need to find such and such item with such and such specs and the optimal farming route for your level is this one so let’s get this shit done!

A well designed computer game is like a Waterfall project manager’s wet dream. End outcome is very clear(farm level X in Y minutes), the process of getting there is well described(guides, almost all game variables are numerical and their interactions are simple to model), and the acceptance test is obvious(I am farming level X in Y minutes, or I am too slow or I am plain dying and/or not doing enough damage).

I think you need to bring your development process and gaming closer together.

In terms of the feedback loop use tests and todos. If your tests are failing you know you’re not done, if your todos are falling behind, you know you’re not done. Have some automated performance/acceptance tests, I find seeing simulated user behavior being successful as much more satisfying than internal unit stuff. This is likely what you do anyway, so the problem is probably at the long-term level:

Do you have a clear outcome in mind? Do you have a clear path to that outcome? Is what you are doing at a given moment helping you achieve that outcome? Do you have a connection in your mind between delivering your project and achieving your life goals? Is working for yourself really what you want? Will you be happier in 30 days for having written the bit of code you are writing right now?

Try and answer those questions based on what you feel about the question not on whether saying you prefer gaming to programming means you are a good or bad person.

Plan more! Connect your day-to-day coding to your project’s big picture. Make a list of features/tasks that are left to do before a project is ‘done’ and go over it every day before and after you start the day. What did you cross off that day? Where has progress been made? How much work is left over? Does the overall plan need to be adjusted?

Finally, reprogram your view of gaming. Every time you accomplish something in a game write down this: ‘Today I managed to get a 12 win in Hearthstone with a Mage deck. I earned 300 gold, a card pack with a Leroy and some junk in it, and $0. I predict that this will contribute to me earning $0 going forward.’ Money isn’t everything, but it’s not nothing either.

Do the same for programming tasks. Make a note every time you do git commits, for instance. Every little task will STILL be worth $0 immediately, but the end will be different: ‘I wrote the authentication module for my new project, fixing a security issue with token-based auth. I improved the speed at which users get past the login process by 30%(.65 seconds) and it’ll be easy to move the module to a mobile back-end API later on. I predict that this will contribute to me earning $nice_chunk_of_money going forward.’

At the most fundamental level there is one difference between casual gaming and programming: human beings value one of those activities enough to transfer some of their resources to you in exchange for having you help them. The other one makes it obvious when you level up.

Source: this is how I got through college and got myself to actually improve and use my programming skills. Good luck.