Find your spot or your zone.
A place where you enjoy coding.
This helps you build consistency and eventually a habit.
On days that I'm feeling really creative and motivated, I can code anywhere even in the couch for long hours.
But, on days that I'm procrastinating/not very motivated, I would go to "my spot", which is the library/coffee shop/somewhere with working people around/somewhere with a window and a nice view.
Whenever I'm there, I couldn't slack off since I'm so used to working when I'm there, and I enjoy the time I'm there.
Find your spot, and maintain it that way (e.g. don't play games / look in your phone much when you're in your spot)
When you do it enough of times, the moment you step into your spot, your whole self is prepped up and in the zone already.
Next obvious question: how do you find your spot given you spend weekdays in office and weekends in your room?
Yes exactly, it's hard to start a new habit on very familiar places for us
So I suggest going out to somewhere you can code peacefully without distractions.
When I started, I used to go to the university library since I'm surrounded with people studying so i would feel guilty to slack off.
If going out is not an option, try to establish an environment in your place that's significantly different than your daily routines.
For me it's a matter of place. For others it could be a matter of time. Try to set aside 15-30min per day for it. And make sure you don't miss it for next 2 weeks. I read somewhere that it takes a certain amount of time to build a habit, 2 weeks of 15min a day sounds like a good start. Since it's little but it's consistent.
Also look for meetups in your area for coding sessions
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.