Developers should be lazy; here's why
Published: 2022-11-25 07:13:50

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:

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Ew. Lowest effort option? That ethos couldn’t lead to great software…<br><br>That being said, when I’m speed coding on <a href="https://twitter.com/LeetCode?ref_src=twsrc%5Etfw">@LeetCode</a> I’ve begun dropping the semicolons. I’m so ashamed of myself. 🤦‍♂️😜</p>&mdash; Zakery Kates (@zakkates) <a href="https://twitter.com/zakkates/status/1591210130150150144?ref_src=twsrc%5Etfw">November 11, 2022</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">I disagree. Semi-colons are there to separate the end of each line and therefore serve a purpose to both compiler and programmer. There&#39;s no way low effort is always the best policy - it just leads to lazy programming.</p>&mdash; Daniel Hartgrove (@danhartgrovexyz) <a href="https://twitter.com/danhartgrovexyz/status/1591423705821089794?ref_src=twsrc%5Etfw">November 12, 2022</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

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](https://www.amazon.co.uk/Programming-Perl-Unmatched-processing-scripting):

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9a7arvcxf5n618p2h26u.png)

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.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w4oq1gnb7jtfo1eyvubz.png)

Besides, [I no longer believe laziness is real anyway](https://www.amazon.co.uk/Laziness-Does-Exist-Devon-Price-ebook/dp/B08C1G3J1T/ref=tmm_kin_swatch_0?_encoding=UTF8&qid=&sr=).

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](https://support.google.com/analytics/answer/9900444?hl=en) and [GA4's measurement protocol](https://developers.google.com/analytics/devguides/collection/protocol/ga4) 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.