GreenCoding: A sustainability practice all software engineers should adhere to
In this blog, Dean Clark (Chief Technology Officer, GFT) talks up the environmental benefits of taking a greener, more considered and efficient approach to software coding.
The amount of energy required to power a datacentre is no secret. In fact, it’s widely acknowledged that the total energy consumption for the 7.2 million datacentres worldwide amounts to around 1% of global electricity demand.
As a result, datacentre providers have invested considerable amounts of money and time into making their sites as efficient as possible. Google has set itself an ambitious target of running its whole datacentre estate on carbon-free energy by 2030. Meanwhile, Amazon Web Services (AWS) is on track to power its entire operations with 100% renewable energy by 2025.
The challenge for society globally, however, is that our use of datacentres is only going to increase as we continue to digitise entire sectors and even countries. And, while it is absolutely right that datacentres are powered by renewables and carbon-free energy, our goal should be to lower the energy needed to ultimately power the sites.
Software coding: Going green
One way this can be achieved is by adopting GreenCoding practices, which consist of a collection of processes and principles aimed at reducing the energy consumption of software, which requires software engineers to be more considerate of the code they are writing and how efficient it is.
Coding, for the most part, can become greener almost instantly if we adopt the same software development processes as our industry did 20+ years ago, when coding was confined to strict lengths and sizes.
Over the years, our ability to write longer and less refined code, with an increasing number of shared frameworks and libraries, driven in part to push to get solutions created in ever-decreasing cycle times, has meant we have almost limitless programming capabilities today.
While that has certainly benefited the speed of digital transformation and the modernisation of organisations and industries, we have now reached a critical time where we must reflect on our ways of working.
Looking ahead toward a net-zero future, we must find a balance between programming quality and energy usage. File sizes of text, images, or video can nearly always be downsized. A simple media compression tool can cut file sizes by more than half, promoting better user experience, faster navigation, and lower energy use. Website developers need to know when to prioritise high-quality multimedia, and when smaller files can achieve the same goals. Having fewer large files also decreases loading times, helping businesses with their SEO and sustainability efforts simultaneously.
The figures for putting the time into making our software more efficient speak for themselves. For instance, by reducing the resolution of screen images on a mobile banking app with 500,000 users, developers could save more than two days of operating time usage a year.
Taking green coding one step further
While being more considerate with our coding practices will have an almost instant impact on the energy consumption required to run our software, there are also steps that software engineering firms and digital transformation organisations can take. For instance, GFT are offering company-wide Green Coding training at all levels and making it part of the onboarding process. Other businesses can – and should – follow suit. We should make Green Coding a practice our entire profession must adhere to, to do our bit to reduce our environmental impact.
The pressure thus far has been firmly on the datacentre providers to become more sustainable. However, as software engineers, we must also acknowledge the role we are actively playing in contributing towards the 1% of global electricity demand being used to power these sites.
Let’s rethink our approach to coding.