Sure, the reds, blues, and purples on the IDE look like a ton of fun, but there comes a time when styling a navigation bar for 2 hours just isn't as fun anymore. And that's just for one project. Now if you have multiple sites to maintain and they each involve their own unique, but complex, navigation bar design, then you're in for a treat of the senses as you attempt to manage all of them.
Writing code can be a fantastically fun time, especially when you're building something that's complex, useful, wide-reaching and innovative. But not every project will be these things. And you will get bored time and time again. But that doesn't mean it has to bring your project or you to a halt. The following are a few helpful tips that I use myself time and time again and that I've used for the past decade to avoid getting bored when writing code.
Create your very own boilerplate
This is the ultimate goal for any programmer. And thousands upon thousands of frameworks have come out to try and tackle the issue. Most, however, just end up doing the same thing over and over. And updating these frameworks tends to come with its own issues.
So what is a boilerplate. Well, technically, a boilerplate is any code that wraps a more low-level set of code in order to reduce the overall complexity. It's essentially a framework, such as Bootstrap. The issue with Bootstrap, of course, is that not every website that you will work on, will be running it. Which brings us back to the same issue as before. And that's managing a nav bar in Bootstrap, and also in something else.
And ensuring that every single project you work on runs Bootstrap is out of the question. So what is a developer to do? Well, you can build your own boilerplate to match your exact specifications and your exact coding style. A big part of what makes writing code boring is the repetitive nature of it. How many login pages can you code before you realize that you need to change careers?
The cool thing about building your own boilerplate is that you will never have to write repetitive code in order to build it. Each and every line that you code will be there to replace complexity in exchange for generality. And coming up with this general structure is a challenge, to say the least. Can you build a login module that will run on any website? You probably can, but it won't be easy. You will have to break the entire process down step by step and then try to put it back together in as few pieces as possible.
Don't skip the complexity
We've all been guilty of doing this. In the name of finishing a project faster, we bypass the long route on how to accomplish something and we settle for the quick and easy hardcoded approach. Nothing wrong with this of course, as the result, will be the same. But at some point down the line, it will come back to you with a Chesire like grin. So my advice, don't skip the complex approach. Not only will you end up with safer code, but it will be more scalable and you will make someone else's job much easier down the road.
Travel around your tech stack
Nothing wrong with that at all. But believe me, you will at some point get incredibly bored. You can only do so much with server-side code. For the most part, you'll connect to a database, get some data, bind it to a collection and return it. Which is why learning to grow into a full-stack developer is definitely a route one should consider. Not only does it normally come with a higher paycheck, but you'll have much more variety in your day to day work. You'll be logging on to a dozen servers and debugging slow databases, followed by designing login pages and writing encryption code to top it off.
And equally, just knowing how the entire system works and its put together is fun in it of itself. Many a time, the boredom creeps in when you have no idea what is happening in your vicinity and so you end up trying to ignore it.
Stop coding and figure out why you're bored
Many a time, your boredom has absolutely nothing to do with your code. Code is code. Sure you can always write more and you can always improve and build up and up. You can do that forever, and end up with something pretty solid in the end. But many a time, halfway through this journey, your typing slows down and you can't seem to think and you have no idea why. Something so simple seems so complex, and we interpret that as boredom.
This is a good time to stop doing what you're doing. If anything, you'll probably just make things worse and ruin some perfectly stable code. I wager that most code written that was full of bugs and security holes came from a dev who lost a bit of their luster.
No really, stop coding
This life is soooo vast that I willingly misspelled so just now. But it is. You weren't born to just type code that you translated from meetings and random emails. Coding is a tool. A pretty fantastic tool to be honest. It's one of the few man-made contraptions that allow us to create from the level of 0's and 1's. You can't really get more granular in this reality than 0's and 1's. But tools were meant to be put down. To rest. To recover. We can't be our best versions in life if we don't allow ourselves the ability to go out and explore a bit what it has to offer.
Balance is always important. The probable answer as to why you're bored when you code, is because it got boring. As simple as that. Don't sit there and force out loop after loop in utter confusion in an attempt to trick yourself into thinking that you're doing something complex or important. Step away. Go read a book. Go ride a bike. Go say hi to that neighbor that you've been meaning to talk to but you're always so busy coding that you run inside and lock the door.
Believe me, life is not boring. Maybe the way that most people are living it has become boring. But life in it of itself is this fantastically crazy thing where you can go out and simultaneously grow as a human being while helping other's grow while doing new things while drinking good coffee and laughing about random nonsense. At least for a little while. And once that good feeling comes back. Once you saw how much fun life can be, then fire up that IDE and see the difference for yourself.
Walter Guevara is a software engineer, startup founder and currently teaches programming for a coding bootcamp. He is currently building things that don't yet exist.