Several Udemy courses, uncountable hours on Stack Overflow, and an embarrassingly high number of rage quits later, I have acquired quite a few methods of keeping myself focused whenever I’m taking on a new skill. In these tough times where we saw cities like New York turn into ghost towns and nursing homes become a source of heart-rending news, I hope these techniques help you make learning at home less of a torture.

1. Break Your Project Into Smaller Milestones

As cliche as this may sound, dividing your project into mini-projects makes it less daunting. For beginners, taking on a new language gets overwhelming due to unique syntax. The benefit of divide-and-conquer is that finishing those smaller projects will give you a feeling of accomplishment, allowing you to stay motivated.
For small-scale or hobby activities, I would recommend using Trello for project management. It has a clean, highly customizable interface with several templates to choose from. 
Image for post
Moving tasks from “In Progress” to “Done” gives a feeling of accomplishment to keep you motivated.

2. Use Online Sites for Inspiration, and Inspiration Only

This one is for aspiring web developers and UX developers. Sources like Dribbble and awards are great for your occasional motivation. However, to think that you can achieve that level with just a week of learning is a stretch. People behind those projects have decades of experience under their belt, which these websites fail to portray. I am not taking anything away from all the talented creators who are contributing to the world of web design, but using their work as a goal for your learning process is only going to make you lose interest as you start realising that it requires a lot of time to acquire that skill level.
A technique I use when browsing Dribbble and awwwards is to save the ones I like. Then, I dissect the components of each project, thinking how differently I would have done it if I was the one designing it. If I end up coming across a unique design feature or trick, I write it down for later reference. After doing this for some time, you will end up with your own little book of design hacks.

3. Work Smart, Not Hard

Learning a new framework or a language doesn’t have to be a 9–5 job. It is enticing to dive headfirst into learning something new. However, considering how complex all the languages with their diverse set of frameworks are nowadays, the only way to stop getting overwhelmed and lost is to map out your pathway.
Decide on your end goal — a specific function you want to be able to perform with the language. For example, if you are getting into Python for the first time, choose whether you plan on doing web development, in which case you should be moving towards learning Django. Or you want to take on machine learning, for which you need Numpy and Pandas before you can advance to more expert libraries. Figuring out a pathway like this will allow you to stay focused, instead of jumping between frameworks without gaining any expertise.
Image for post
Image for post
Road map (made by GitHub user Kamranahmeds) I used during my journey as a web developer.

4. Create a Reward System for Yourself

Image for post
Image for post
Photo by Ben White on Unsplash
This technique goes hand in hand with breaking your projects into smaller milestones. Instead of coding on hours on end, design a reward system to give yourself a little something each time you achieve your mini-goal. The reward can be anything, depending on what you enjoy doing. It can be an episode of your favorite show you have been meaning to watch, a visit to your favorite park, or something as small as eating your favorite candy.
The sense of accomplishment and anticipation of the rewards leads to the release of dopamine, which will prevent you from losing interest in your projects. According to WebMD,
Dopamine plays a role in how we feel pleasure. It’s a big part of our unique human ability to think and plan. It helps us strive, focus, and find things interesting.
Regardless of what your reward is, it is the prospect of that reward, and the motivation leading up to that moment, which matters.

These techniques are not ingredients of a magic potion (I wish they were!), so they are not going to work as such. However, after employing them in my workflow for several years, I have noticed slight improvements in how efficient I am, which all add up to make a massive difference in the long run. I hope they work out for you, too.
Good luck with your coding journey!