Bloat, the burning of unnecessary computer resources, is a symptom of a lack of knowledge.
Most people are not deliberately trying to make their code resource-inefficient. It’s just that they have a job to do, and they know just enough to get it barely done. Extras like bloat, security, and extendability are off the table. To handle them properly requires knowledge they do not have, nor the time to acquire it.
There are infinite ways to accomplish any task with a computer. But these days they are all wrapped in inconsistent primitives or calls which are often quite messy. If you understand what’s really below that level, you can figure out how to utilize it to do only exactly what you want. But if you don’t really understand how they work, you're left chaining them together and fiddling until the output approximates your goals.
This has been understood since the 60s, often called the software crisis. The higher we build the house of cards, the more disconnected each new generation gets from what's holding it all up.
The rise of don’t look before you leap philosophies of development fuelled the problem. Coders are in such a panic rush that they just have to grasp at what is easiest, but combined with tunnel vision, that is also usually what is pretty wasteful too.
If you’ve got some fiddling to do with a string, then most people pick the most popular primitives. When they realize that the combination does a bit of extra work, they discount it as a micro-optimization. It’s not; it's a lack of knowledge driving the deoptimization or bloat, as we like to call it.
If they knew more about how it worked underneath, they’d pick a different set and augment that with better code of their own. The output would be the same, but the wasted steps would be gone. They weren’t needed.
That’s a trivial example, but we see this with fiddling, calling libraries and APIs, allocations, polling, queuing and caching, pretty much all over the place. There is some reasonable way to encode the steps, but getting there requires understanding what the steps actually do. Not a guess or a vague understanding, but not enough knowledge to be able to implement them yourself.
Q&A sites fuel this, because they give people a magic sequence, thus offering them the option to just blindly use it.
If you knew better, most people would choose to write the code properly; it doesn’t take more time. If they write bloated stuff, it is because they didn’t know better.
When computers were really slow, bloat was obvious and often unworkable. As Moore’s law kicked in, bloat became just another consequence of the race to get more code out there. But as Moore’s law fades, we'll be forced to return to those early days when people coded with more precision. To do that, they’ll need depth. You can’t correctly pick the best underlying steps if you have no idea what’s actually underneath. Figuring that out will keep you ahead of the pack.
No comments:
Post a Comment
Thanks for the Feedback!