Green Coding: Sustainability in Software
What does it mean to write green code? As Kirti explains, sustainability efforts in software engineering are not in objection to current effective practices, but perhaps a novel integrative feature of them.
By Kirti Ramesh
October 4, 2020

Living with a software engineer, I have witnessed countless discussions about coding – how it is akin to architecture and how ‘clean coding’ is crucial for efficiency. Our home is often the centre of debates of monolithic versus microservices architecture. If these terms are unbeknownst to you, join the club. Although programming is sometimes a seemingly arduous subject I’d like to approach it with an element of sustainability by touching upon the cornerstones of ‘green coding’. 

First off, what is it?

Green coding is a term recently popularized for its environmental intentions and refers to programming code that is written to produce algorithms that have minimal energy consumption. Research suggests that there are two types of considerations to make – structural and behavioural ones. Structural considerations would encompass the energy measures related to code blocks (units of code) whereas behavioural considerations would be the energy consumption that is related to user scenarios such as sending an email or checking your Twitter feed.

Finding specific examples of green coding in use are few and far between. Several examples of coding written to elevate user experience are synonymous with low footprints. This is because applications that are written for specific devices or that are intuitive to users also have inherently lower energy demands. Worth remembering: green coding is not in objection to current effective software engineering practices, but perhaps a novel integrative feature of them. For instance, programmers often aim for performance and utilise a tool called Big O notation. This allows them to calculate the efficiency of their coding algorithms. For a visual demonstration of how algorithmic design in coding can affect performance, check out this video. The use of such tools and such practices in coding have the side effect of energy efficiency.

Interestingly, programming languages such as Scala or Golang, which are designed to be as lightweight as possible, could also be put forth as arguments towards green coding. However, whilst these languages are utilised by major brands (Netflix, LinkedIn, Google, etc), they have specific use cases of high performance which has so far limited their adoption as mainstream programming languages.

Many software engineers would argue that good code in all languages is inherently ‘green’ because they enable high performance. The lack of examples that specifically address eco-friendliness in coding does not illustrate a lack of environmental concern. In fact, it is coding that has led to the development of green and eco-friendly apps and one could argue that code often produces efficient replacements of real-world processes.


Grab our free sustainable living E-book! Go check it out now.