If there is one truth I have learned in my near-thirty years as a developer, it is that programming is far more art than science, more creative than arithmetic.
It requires inventiveness, problem-solving, imagination and persistence. Because of that, it is very, very easy to become distracted. Distraction almost always leads to procrastination, and procrastination is our enemy.
The second truth that I'm going to offer here is that the best programmers are, at heart, lazy. I don't mean lazy as in they sit around eating Cheetos and copy/pasting off Stack Overflow (for shame!), but instead that experienced programmers refuse to code blindly, because we know that's going to double (triple/quadruple) our workload, immediately and down the road.
These guys and gals will expend precious energy (sometimes with their eyes closed … leave them be) contemplating the shortest distance between two points, and when they find it, they will pounce on it. Let the other guy build cathedrals, we are here to build robust, simple and economical applications.
The third and final truth is that, often our deadlines are miles and months away. We are confident in our ability. We are capable.
Our buddies are playing Fortnight/going hiking/chatting in the break room, so all this work can wait an hour/day/week … the yawning chasm of procrastination opens before us, and the longer we dwell in it, the harder it is to crawl out.
Fear is often rooted in the unknown. The thing to remember is, most of what lies ahead of you *isn't* unknown.
There is plenty of room here for all sorts of distraction, especially in early days when everything about the project remains nebulous and unfocused. This is where the fear lives and grows. Am I building towards efficiency? Do I see all the problems? Can I solve all of them? Can I express the solutions in a way the client can understand? This is beyond all the standard problems of what is too much/too little time/cost/resource to apply.
Have I stressed you out yet? Good. Let's work on that.
Fear is often rooted in the unknown. The thing to remember is, most of what lies ahead of you *isn't* unknown. You've navigated these waters before, so we'll start with that.
The first thing you need to do (like, right now) is to illuminate all of the tasks that lie ahead of you. This shouldn't take more than an hour (you're not creating a development task list here, things shouldn't be more specific than "build in user management" or "learn Vue").
Separate the list into immediate, short-term and long-term milestones; this makes the things you need to accomplish immediately much smaller and more evident.
It's all about separating the wheat from the chaff, finding what works for *you* and confidently discarding the rest.
Once you have completed the general list of everything that you need to solve, highlight only the true unknowns (things you've never solved before and are unsure of how you will). Now that you've reduced your list to the essentials, you know what you should be focusing on.
Once you've finished this, congratulate yourself. You now have focus! Now comes the second, tougher, step: motivation.
Fun. That's why we do this. Well, mostly it's food and shelter, but fun is the reason most developers *chose* this profession. Development is fun … honestly, it might not always seem it, especially at 2 AM the day before a deadline … but hey, we're working on not getting yourself into that position. So, fun.
How do we get to the fun? Professionally, we often find that in "Flow". Flow is the idea of synergy between challenge and efficiency. The things we are working on aren't so easy we can do them with our eyes closed, but neither are they so difficult we are constantly stressed and, yes, working at 2 AM trying to solve them.
Some of it is reprogramming your measures for success. Finding joy in completing smaller milestones and tasks (earning healthy rewards or short breaks) is a great start.
As I mention below, there are dozens of theories on how you can increase your motivation. Some of these are changes in diet (less butter, more kale), exercise (shut up, you!), and lifestyle (like the first two aren't enough). These are all correct, but they don't have to be absolutes and happen immediately. Baby steps, my friend. There's always room for stupid self-challenge (no sugar/beer/video games for a month) that can trigger monumental change, but better is finding reward in minute but gradual change. One scoop instead of two.
Since our goal here is to eliminate distraction, find small ways to do this. Put on headphones and listen to music. I prefer dark orchestral movie soundtracks like Master & Commander and The Fountain, for you it might be Ska or Kenny Loggins, just find something that separates yourself from the world around you. Switch to decaf. Lower the blinds. Close the door (or open the window). Grow a beard (or shave it off). Put a post-it on your back that says, "Stay away please … in The Flow". Experiment. Hack yourself, find what works and stick with it.
The human mind is wired towards achieving goals. Taking pride in the small things will push yourself towards the next goal. Hack yourself, but not all at once.
There are all sorts of very good books on how we can achieve this, and sometimes they compete in methodology. "THINK BIG" "THINK SMALL" "THINK LONG TERM" "THINK IMMEDIATE" "BE A SUPERSTAR" … eesh. The Motivation Hacker by Nick Winter and The Motivation Myth by Jeff Haden are both excellent books, yet each focus on techniques that would compete against each other.
The Zen approach is dividing tasks into small, achievable wins. Lists of lists, checkboxes ticked. The Superstar methodology forces epiphanic moments: leap out of planes, quit your job and launch your own startup, scream in the face of your fears. A life lived in emoji, because words take too much time!
The world will always move faster, there will always be people who are better or know more about one specific thing, there will always be goals you will never achieve.
Chances are you fall somewhere in between these two, and that's fine. It's all about separating the wheat from the chaff, finding what works for *you* and confidently discarding the rest. The important thing is to keep challenging yourself (learn a new programming language/read a difficult book), while throwing in the occasional big one (learn to play the guitar) to keep yourself honest, and giving yourself a break on not becoming an instant superstar. (Every new chord you master is a win!)
Procrastination is not about being lazy, it about our natural tendency to avoid the things we are afraid of. There is ample scientific research for this (take this recent BBC Article: Procrastination: It's pretty much all in the mind).
This fear might be material (going parachuting), ethereal (proposing marriage), or just stress (completing a difficult task for work). This fear, whether rational or not, will continue to stall your progress as long as you let it. That fear will remain, however, and exist unrealized for as long as the associated task remains unfinished. This is also known as life. The real irony here is that, once completed, the fear that was blocking us is almost never realized, it never materializes.
There are ways to moderate this fear. Self-imposed deadlines are always better than shared deadlines, which add stress. Organizational tools remove the "what should I do next" trap. Managing distraction removes easy exits from where your focus should lie.
Some of it is reprogramming your measures for success. Finding joy in completing smaller milestones and tasks (earning healthy rewards or short breaks) is a great start. Give yourself room for failure, which is massively important in finding success (listen to Will Smith talk about it). It's all about management, of time, of resources, of your sanity and quality of life. A happy you is an efficient you.
The world will always move faster, there will always be people who are better or know more about one specific thing, there will always be goals you will never achieve. Some of these things are truth, some of them are lies. They all depend upon your motivation, your ability to not procrastinate, to build yourself up. Just because you aren't a thing now, doesn't mean that you will not be eventually. Maybe you won't reach your goal in your 20's, or 30's, or 40's. But someday, as long as you keep working towards it, you will.
Keep working at it, a little bit at a time. Keeping focused on what's in front of you will give you more time and freedom to pursue the everything else, because there will be less fear and more fun. Most of all, give yourself a break. Life isn't a competition, it's a ride. Enjoy it.