I believe it's a good thing for programmers (or any worker, really) to be lazy.
I truly think hiring managers should seek the laziest developer they can find.
All right, people, put your pitchforks down and let me explain.
Two kinds of laziness
On Twitter the other day, someone asked if one should use semicolons in JS. My take? I don't bother. To me, it's wasted typing, wasted effort for no benefit. It doesn't make the code any better or easier to read, and it might save a few milliseconds here and there. I'm all about that. I'm all about choosing the path of least resistance, what I called "the lowest effort option" in my tweet. This caused a bit of a storm in a teacup, and triggered a few folks:
Ew. Lowest effort option? That ethos couldn’t lead to great software…
— Zakery Kates (@zakkates) November 11, 2022
That being said, when I’m speed coding on @LeetCode I’ve begun dropping the semicolons. I’m so ashamed of myself. 🤦♂️😜
I disagree. Semi-colons are there to separate the end of each line and therefore serve a purpose to both compiler and programmer. There's no way low effort is always the best policy - it just leads to lazy programming.
— Daniel Hartgrove (@danhartgrovexyz) November 12, 2022
There's a few valid technical points there, but the response that bothered me most was the immediate "ewww, low effort? That's for losers." gut reaction. It bothers me because they misinterpreted what I meant. I wasn't talking about slacking off and not doing a good job.
I believe these responder read "the lowest effort option", and understood "low effort all the time". That is not what I mean. I was talking about true laziness, the way Larry Wall describes it in the Perl book:
The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don’t have to answer so many questions about it. Hence, the first great virtue of a programmer.
True laziness = optimisation
You see, dear reader, we're not talking about slacking off here. It's not about copying and pasting code manually until it's time to go clock out and go home, because you can't be bothered to write a script with regexp or two that will do the job for you in seconds. Writing the script takes more effort initially, but will save hours of tedious labor down the line. And maybe help your colleagues. And give you more free time to work on something more interesting, or just to relax for a bit if you feel like it.
I want to take the path of least resistance, yes, but it's only to get more quality, to scale, to speed things up, and ultimately, to avoid spending precious company time on useless BS.
Besides, I no longer believe laziness is real anyway.
I came across another example just the other day. A collegue was implementing a new (temporary) payment feature on one of our sites. We needed to track when users finalised a purchase on the site in both Universal Analytics and GA4. Because there were a few odd parameters in the tracking, he was planning on triggering the events in his code, using Universal Analytics's measurement protocol and GA4's measurement protocol directly to track all this. Keep in mind we already had a fully fledge Google Tag Manager setup, with both UA and GA4 configured. My Lazy brain just went "do we really need to do all that work for a temporary feature?". Turns out there was a simple, low-code solution: just push data about the purchase in the datalayer, and tweak GTM to trigger the events correctly. Boom. All done in a few hours.
I spent the rest of the day watching TV. Just kidding.