7 tips for being a better, more efficient programmer

I've been talking recently about working a shorter, more efficient work week and wanted to share some of the things that I've learned over the years that help make it possible. Below are seven tips that will boost your productivity at work and help you avoid headaches at home.

1 - Pen and Paper
When you get a new project, don't jump straight into coding. I know it is tempting to get started right away, but take some time up front to think about the project. Outline what possible classes you may need to write and what methods those classes should contain. The idea here is to blueprint the project on paper before you get into coding.

Once you have a nice draft down, go over the relationships between various objects and look for any potential problems that may arise during implementation. It's a lot easier to fix these problems on paper as opposed to having to refactor a portion of your code base due to unforeseen snags. With a solid foundation on paper, the actual coding becomes a matter of following directions as opposed to engineering on the fly.

2 - Make a to-do list
Give yourself a goal each day for projects at work. Say to yourself, "ok, today I'm going to get X done." Write it down and then focus on just that one thing until it is complete. All too often developers set out to accomplish a task and end up getting side-tracked with implementing numerous other features and the main task suffers as a result. If you have a specific goal written down and find yourself working on something unrelated, it's a lot easier to drop it and get back to your main objective for the day.

I recommend making a to-do list a few days ahead of time so that you don't waste time in the morning trying to decide what you're going to do that day. Without a to-do list, you don't really have a specific goal and more times than not, this will lead to a wasted day where nothing in particular gets finished.

If you happen to finish your to-do list for a given day early (and most of the time you will), don't get started on the next days' tasks. Instead spend the time cleaning up the existing code, eliminating bugs or adding helpful comments. If you start on tomorrow's tasks today your schedule will begin to fall apart and you'll find yourself wasting time again.

3 - If you're stuck, get away from the computer
We've all hit problems that stump us for a while, but sitting in front of the computer screen for extended hours does little good. At best you'll find yourself with a headache and an inelegant hacked solution based on the confines of the code you've already written.

If you get stuck on something for a while the best thing you can do for yourself, and the project, is to take a bit of a break. Get up and grab a snack or take a walk outside for ten or twenty minutes. This will give you time to think about a real solution and how to implement it... even if that means deleting existing code.

4 - Don't work late
This one goes hand-in-hand with number three. If facing an especially difficult problem you may feel compelled to stay at work until it gets sorted out, but that's probably the worst thing you can do. When you're working late and you're tired you will make poor decisions. You'll end up writing sloppy, bug-riddled code just to get a half-assed solution in place. Instead of forcing yourself to stay late and finish, go home and eat dinner; relax and come in refreshed the next day and start with a fresh approach to the problem.

I can't tell you how many times this has helped me out on projects. One example is a facebook application I was working on at a web agency. Everyone on the team was working late nearly every day and things weren't getting any better. One night we spent an additional eight hours working on a particular feature and had it working, but it was really sloppy code. After going home and getting some sleep, I came in the next day feeling refreshed and in about 30 minutes came up with a much cleaner and easier solution for implementing the feature. Essentially the previous night's eight hours of work was completely useless; we deleted the code and implemented the new method before 10:00 AM.

5 - Stop doing freelance work
Freelance work can be a nice secondary source of income for many of us. However, it can also be a major source of added stress and will suck up valuable time that could be used doing something you really enjoy. If you can afford it, I recommend dropping the freelance gigs. Instead focus on your own projects. Make your own mobile apps or websites or whatever it is you want to make. You may not make as much money, but you'll probably be a lot happier. And who knows, perhaps one of your projects will make it big!

6 - Do a little every day
Sometimes just thinking of a project as a whole can be overwhelming, but you don't have to kill yourself to get your projects done. Instead of going for marathon coding sessions on personal projects, try doing just a little each day. Even if you set aside just one hour each evening you can still accomplish a lot; especially if you keep the other items on this list in mind. It may take a while to finish a project, but getting those small victories will help keep you motivated from day to day and you can certainly work more if you really want to!

The key here is to make sure you don't take a day off because if you take one day off, you're likely to take two and so on.

7 - KISS (Keep it simple, smarty)
Yes, I know most people end this with "stupid" but I don't think that makes much sense. What's more stupid: going with a simple, straight-forward approach or over-complicating things and giving yourself unnecessary headaches? I submit that the simple, straight-forward approach is the smarter of the two.

If you find yourself writing a big mess of code thinking "there's gotta be a better way of doing this" then there probably is. Stop what you're doing and reevaluate the problem. Try breaking it down into simpler sub-problems and start from there.

Bookmark and Share

One Response to “7 tips for being a better, more efficient programmer”

  1. Sudheer says:

    Good Tips. Definitely will help lot further

Leave a Reply

Subscribe to RSS feed FGS5 Badge