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.
Comments 3