4 ms·
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
by commandlinefan 6y ago
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.
- npsimons 6y ago> 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.
- thomaslord 6y agoI'd argue that everyone should at least pursue competence.
- npsimons 6y agoAgreed. 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.
- Delk 6y agoThe "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.