Spoiled by Abundance

Most of us are spoiled by abundance – in personal life as well as in programming life. The machines that run our code keeps getting better- faster, larger and cheaper. The things we need seem to be available in abundance.

This gives us a false illusion of unlimited resources. This is why we didn’t bother to conserve or recycle anything before. In programming life, this gives us a mentality of throwing more hardware to solve a problem, any problem, as a first and often preferred choice of solution.

I think this (state of affairs) is sad and it reflects unconscious programming.

The limited resource constraint is still very real. The machine you already have can only take so much RAM and the CPUs can only go so much faster. Of course, you could keep swapping out for better machines, but you might still be constraint by budget.

There are genuine cases where you need to swap out for better hardware. But I doubt if that’s the case for a large majority that opts for this solution as the default choice.

One who is resource conscious and the one who isn’t, both have the same thought process “I won’t do this because I don’t need it (or I don’t need to)”, but applies differently.

The resource conscious and the performance inclined could apply it thus:
I won’t make 2 calls to the database to get this data as I can get the same data in one call if I do X.

The other could apply it thus:
I won’t do X and do it the 2-call way as this had not proven to be an issue.

And there are others who don’t think about any of these. They are blissfully unaware of their mounting technical debt until the day when everything comes to a crashing halt and wonder what happened- well, its time for rewrite.

I’m aware of premature optimization and the issues around it. But this is not that. A simple ‘for’ loop could perform much better depending how we code it. This is a programming model, a paradigm and developer’s mental model (& maturity), rather than an optimization exercise.

Efficient resource utilization and high performance of the system should be given priority over developer’s convenience.

Perhaps one way to bring this awareness could be to have developers work on obvious and explicitly specified resource constrained environment as a side project or as a fun activity or a hackathon. For example: an app for a rural village in a underdeveloped country that would run on a 15 year old machine and they don’t have the means to upgrade. Or working in an embedded environment or even a mobile app, with clearly stated performance goals.

It would take willingness to participate in such programs and perhaps some enticing, some pushing even. But I think that such exercises, even if hypothetical, would still help bring awareness to the masses.