(Un)ProductivityGuest Post

How Being Idle Helped Me to Be a Better Programmer

I’m excited to present the first friendly anarchistic guest post on this site! It was written by Oscar Del Ben who writes about personal development and productivity over at FreestyleMind. You absolutely should visit his website and subscribe to his RSS Feed. For The Friendly Anarchist, Oscar writes about how smart idling may lead to better results in the work of a programmer.

When we hear the word idle, we often think at laziness, undoing things, etc. But being idle is not necessary a bad thing, and in this article I want to share my experience of how being idle helped me to be a better programmer.

There’s a famous principle in programming called “Don’t repeat yourself”, or DRY. This principle states that if you have already written a function to accomplish a task, you shouldn’t write it again to solve a very similar problem – instead you should use a higher level function that does the job for both scenarios.

For non programmers, we can give another definition of DRY, which is more general: Don’t repeat what you already did.

In general, you are considered a better programmer if you can write something that works well and can adapt to change, and DRY is often the easier way to achieve that state. Now, the DRY principle may be one of the most important things you’ll ever learn, and programming is just one area when we can apply it.

For example I have many websites and I need to do a backup of them every day. Usually you just log into each server and download a backup of the database and of the application files. This is a time consuming task, so I’ve written a program that does it for me. Even better, the program saves the backups with the date in the filename, so I can go back in time if I need to. Now I only need to run a command to have a full backup of all my websites. This is smart idle.

But as I said, DRY is not limited to programming. For example, if you leave lots of blog comments, you should consider the use of a plugin that automatically fills your name, URL and email address in the comment area. I use a program called Text Expander on the Mac, which works as a text replacer. For example, if I type “bxxx” then the program will automatically replace it with my blog address. You can use this program for a lot of other situations.

If you learn to apply the DRY principle, you’ll accomplish a lot of tasks that were only eating your time. I believe that we should focus on creating new things, and not on maintaining what we did previously, and here’s where DRY comes to help.

Illustration based on a photo by Giorgio Montersino.

Enjoyed this article?

Share it with friends on Twitter or subscribe to my newsletter to stay up-to-date!

{ 3 comments… read them below or add one }

Oscar - freestyle mind December 22, 2009 at 2:08 am

Thanks Fabian for giving me the opportunity to write for your blog!

Reply

Fabian December 25, 2009 at 11:59 am

Just stumbled upon this and thought it might be a good add-on to your article, Oscar: “Programmers are most effective when they avoid writing code. They may realize the problem they’re being asked to solve doesn’t need to be solved, that the client doesn’t actually want what they’re asking for. They may know where to find reusable or re-editable code that solves their problem. They may cheat. But just when they are being their most productive, nobody says “Wow! You were just 100x more productive than if you’d done this the hard way. You deserve a raise.” At best they say “Good idea!” and go on. It may take a while to realize that someone routinely comes up with such time-saving insights. Or to put it negatively, it may take a long time to realize that others are programming with sound and fury but producing nothing.”

Read the full article here.

Reply

Fabian December 22, 2009 at 4:27 pm

You’re welcome Oscar! Great to have you here!

Reply

Leave a Comment