Following the “Green Coding”

Vishnu U
Nerd For Tech
Published in
3 min readApr 27, 2024
https://www.linkedin.com/pulse/going-green-future-software-development-bipin-dayal/

The trend of ESG started a decade ago. Influencing the operations of a business primarily, it slowly leaked into the technology domain influencing technology practices as well. Tech companies have been following ESG norms in all possible methods. From Microsoft performing a carbon-aware Windows update to organizations using green methods to cool data centres, ESG has found a place in the tech industry too. In this article, we will look at ESG from the POV of a software engineer — What can a programmer/engineer do to ensure green coding practices are used?

Adopt efficient algorithms

As the solution to a problem becomes more complex/time-consuming more energy gets used. Adopting efficient algorithms will ensure the solution is found quickly will less energy relatively. Preferably, avoid using brute force approaches since they require you to browse through the whole data.

Store data carefully

On a holistic level, the more data is stored, the more servers we need and hence more energy. Avoid storing unnecessary data and use archives if required. When designing databases, keep in mind the use of each column since this adds to the storage of the server. To make this process easy, ensure the data stored should match the future requirements of a user or the app.

Reduce requests to the server

Each time a request is sent to the server for setting or getting data, energy is used. The whole science of generating a request signal from a device to reaching the server and back requires energy. Hence, reduce the requests to the server and reduce the payload of each request too. The more data, the more energy is required. Hence, all server requests should be designed with the requirement in mind. Use efficient design principles to reduce server requests.

Choose the right language

This might be a brainteaser, but the programming language itself has an impact on energy conservation! The reason behind this is that how each programming language works. C directly converts it to machine language, while Java uses a JVM, which uses more energy and directly executes a machine code. Thus, if alternates are available, choose the right one which uses the least energy. This is not possible in all cases, since Data Science will require languages like Python / R / Matlab.

Cleanup cloud resources periodically

The invention of the cloud has created a situation where the resources once created are sometimes forgotten or not cleaned up thus adding to used energy if active. Every organization should have a period cleanup of their cloud resources if not needed or switch them to hibernate mode if not needed at the moment. This ensures savings on energy and costs.

In a nutshell…..

“Green coding” involves reducing energy at all levels in a technology practice. There is no handbook for following the green coding practice. Just like the saying goes “Sustainability is a mindset”, green coding is also a mindset. A technology practitioner should have a mindset to save energy at each point in a system.

Useful links:

--

--

Vishnu U
Nerd For Tech

Full Stack Developer at LTIMindtree | Enterprise Apps | Azure Cloud | Tech Writer with 15k+ views on Medium | Data Science Enthusiast | 2X Kaggle Expert