Environmentally friendly programming

So in line with previous post, there is something to be said about thinking about the environment when developing any piece of software. Most of the time we all take for granted the nearly limitless amount of resources to our disposal. Memory, CPU cycles and so on. The thing is that all costs energy to use. Energy has to come from somewhere and in general is not good for the environment, not to mention the heat you produce.

When talking about deploying somewhere , let us say AWS. Then it makes sense to carefully think about autoscaling, initial size of the instances, and seriously think about reserved instances or even spot instances. To lower costs but also to lower used resources.

When programming there is a balance between pre mature optimization and effective resource usage. There is the advice don't optimize too early because you might throw away the piece of code you wrote or you only use it once in the program and then it does not matter either. If you have the code in and even though you call it only once. You still need to make that pretty. Not only to avoid broken window theory but also to not use more resources than necessary. Even if it is once at bootup, you might start or boot the application a considerable amount of times before the lifetime of the software is over. All wasted energy if you optimised it. Large numbers apply of course in general but it is the same for response times. You want the shortest response time possible because the user is waiting too. All wasted energy.

In a cynical way you could say the servers are running anyway so what does it matter. It matters because if we effectively consume resources we can achieve more with the same. Minimal amount of material and maximum results.

#devops