Well, mostly.
I hear the excuse a lot from developers, “Oh, because I am lazy”. This seems to be some sort of way of justifying the way we do some of our development, automation scripts, bash power-user commands like grep
and awk
, even writing a program to solve something we could do ourselves manually. Unfortunately, even copy+paste development. We don’t do ourselves any favours using the term lazy though, since not all words can have their meanings reversed, unlike literally
.
I’ve spent some time trying to analyse this, and determine what we are actually trying to convey, and how accurate we actually are by making such a statement about ourselves, or the work we are completing.
I’ve come to the conclusion that most of the time we actually mean we are trying to be efficient. Why spend a bunch of time repeating a task manually, when we can get the computer to do it for us. While the computer is running the task for us, it frees up some real time to stop and think, analyse upcoming problems, or automate/script up the next task to be run.
First, a simple task of moving files. I will use the example of photos in folders that we want to collate correctly. Now, we know that our photos have a taken date, and that is what we want to use for sorting. We could manually create a folder for the first year, a folder for the first month (or 01
really) and then go through the photos one at a time, and when the photo matches that year and month, move it (or copy, whatever) to our new folder. And any reasonable person would spend the next few months doing this, or not bother. But we are programmers. We can write a bash shell command, script file, or program to complete this task for us.
Here comes the efficiency bit: If there are 100 photos, A GUI Power User can probably reorganise these photos manually and get it done faster than most programmers could write, test, and debug a program, and probably faster than the average shell user could script and test a solution. But here is the thing: If we want/have to do this once a week, or once a month ongoing, by taking longer to write the script the first time, you save countless time going forward. This is not lazy, especially if writing the script takes longer, and is more work the first time. The other case is that we have thousands of photos (100s of thousands, even), and by automating this we will easily get it done faster than if we did it manually, and probably more accurately too. Efficient.
A similar argument can be made for creating formulas in an Excel spreadsheet, a mail merge in Word, or a workflow in IFTTT.
This highlights another point. Most of the time we hear someone declare themselves lazy, they actually spend more time on the problem. Writing a code solution will usually take longer than the manual approach. At least in the short term. I wouldn’t use the term lazy to explain someone who rather than drive and get stuck in traffic decides to take a push bike instead. Efficient, looking ahead at the real payoff.
I mentioned Copy Paste. That is lazy. Let me explain… No, there is too much. Let me sum up.
There is a false economy to copy and paste. You might get a quick-win solution running by copying some existing code, then tweaking it a little bit. If you are doing TDD (Red, Green, Refactor) you are encouraged to take this shortcut to get to Green. But if you have to copy and paste multiple lines to code every time you need to add something, you are doing it wrong. Firstly, you have more chance of making a mistake every time you copy. You end up with a maintenance headache have to update all the copies as well.
The correct solution, if you have created one copy, and can see that it will be copied again, is to extract out one or more methods to perform the task that you can call multiple times instead. (“compression-oriented programming” or “semantic compression” - see related). Duplicate code is ripe for refactoring. (TDD step 3, Refactor!)
We should stop calling ourselves and others in our profession lazy. We are efficient, we automate, we are programmers.