News for hackers. Stuff that matters.
Re:Clean code won't save the planet by commandlinefan on Friday November 06, 2020 @02:40PM (#25010461)
I've never been able to understand why so many people push so hard for explicitly inefficient code. If you're competent and you actually know what you're doing and how computers work, it takes just as long to write efficient code as it does to write inefficient code.
Re:Clean code won't save the planet by Delk on Friday November 06, 2020 @05:29PM (#25011761)
The "how computers work" part nowadays involves understanding things like cache efficiency, and quite possibly even knowing whether it's more efficient [1] to compute something locally or transmit it over the network.

These things aren't static, and you can't just have e.g. an understanding of theoretical algorithmic efficiency and call it a day, even if you couple that with an understanding of e.g. CPU tech at time t.

Various levels of abstraction of course fuzzy things up further. You'd then have to understand not only how things work at the low level, but also how your particular layers of abstractions affect things.

With today's tech stacks, that becomes nontrivial real fast.

With that said, yeah, writing at least superficially efficient code isn't really much harder than writing grossly inefficient code if you have a good base understanding.

[1] In this case, in terms of energy efficiency, which is even harder to judge without specific knowledge. Time efficiency is easier to test.

Re:Clean code won't save the planet by npsimons on Friday November 06, 2020 @03:14PM (#25010715)
> If you're competent and you actually know what you're doing and how computers work

There's your mistake - you assume that a) people care, and b) they are competent. Usually at least one is false.

Re:Clean code won't save the planet by thomaslord on Friday November 06, 2020 @04:18PM (#25011283)
I'd argue that everyone should at least pursue competence.
Re:Clean code won't save the planet by npsimons on Sunday November 08, 2020 @12:06PM (#25027086)
Agreed. And competence includes not writing dirty code, but for reasons other than saving the environment. But this doesn't change the fact that for a vast majority of programmers, the work is nothing more than a means to a paycheck, therefore they will do the minimum required to get that paycheck, nevermind how much technical debt they are incurring their organization.