DevelopmentSustainable digital products – the carbon footprint of code
The environmental impact of digital products is a growing concern. While the digital realm may seem intangible and detached from the physical world, the reality is that every line of code we write, every app we use, and every website we browse has a carbon footprint. This is a consequence of the vast amount of energy required to power the servers, data centers, and devices that enable our digital experiences.
This article delves into the concept of sustainable digital products and shines a light on the carbon footprint of code. We will explore how the lifecycle of digital products contributes to carbon emissions, discuss the concept of clean computing, and examine potential strategies to mitigate this impact.
Every click has a hidden cost
The cryptocurrency enthusiasts who are using dozens of computers to solve the complex mathematics needed to mine Bitcoin may think that their activities are costless. But all the electricity their machines are consuming is likely coming from a power plant just over the hill. And that power plant is likely to be burning fossil fuels.
Indeed, the energy used by cryptocurrencies can generate enormous amounts of pollution. According to researchers at the University of Cambridge, the electricity needed to maintain the Bitcoin network alone is more than what the entire nation of Argentina needs to survive.
It’s not much better across the wider information and communication (sector.
In 2011, Barath Raghavan and Justin Ma of ICSI and University of California calculated that all the power needed to build and maintain computers, network connections, cell-phone towers, and other hardware uses about 84 to 143 gigawatts of electricity every year, or about 7% of global energy. By 2040, the sector is expected to account for 14% of the world’s carbon footprint.
So far, most of the pressure to improve sustainability has been firmly on datacenter providers. Google wants to run its entire datacenter estate on carbon-free energy by 2030, while Amazon Web Services is aiming to power the entirety of its operations using renewable energy by 2025.
However, there is still a lot of room for software engineers to be “cleaner” as well.
Most software engineers are at least peripherally aware of the environmental impact of what they do and understand the need to develop clean code.
Sustainable code is lightweight code. To put it simply, it's faster. Our website for Institute of Project Management loads in just 1.2 seconds.
What is clean computing?
Clean computing is a way of writing code that revolves around the energy output of computer functions. It also tries to diminish the demand the software puts on physical servers and systems, as this is where the internet uses most of its energy.
Clean code can be split into two types – structural and behavioral. The adjective structural refers to how the code is written. The adjective behavioral pertains to how people use their computers to send emails or watch videos of cats, all of which consume energy.
A more efficient codebase can help large companies meet their ESG targets, an increasingly important performance metric for both stakeholders and younger software engineers who tend to weigh a company’s sustainability when looking for a job.
On a more practical level, clean code can also help increase the battery life of mobile devices, maximize computing power, lower energy consumption, and combine computing resources for greater efficiency.
Code can be crisp and tight or pompous and bombastic, it all depends on the style of the individual coder. So, the best place to start building clean code is for the software engineer to improve their writing ability.
While it might not seem to be a big problem at first, bloated code results in the computer using more energy overall because the code contains a larger-than-necessary number of useless functions and lines. Inevitably, any computer system running bloated code wastes more energy on processing than it needs to. Not good for carbon emissions.
Yet coders alone can't be blamed for the existence of bloated code. After all, when computing chips were less advanced, code by necessity had to be tighter and shorter. There just wasn’t enough memory. As computers got more powerful, the available memory expanded as well, and now there’s fewer reasons for coders to write efficiently.
And since bloated code indicates wasted resources, a company can ensure a higher-quality product that is more fit for purpose if they encourage developers to writer cleaner code. The trick is to convince software engineers that writing more sustainably is worth the extra effort. Right now, they don’t seem to be so sure about that.
According to a paper prepared for the International Conference on Software Engineering found that where green coding matters most, its practice is worryingly rare. The paper’s authors (from IBM, Google, Microsoft and the University of Delaware) asked if software engineers think about energy usage when they write software.
The researchers found mobile developers used green practices more than any other group (53% said they "almost always" or "often" wrote applications with energy usage requirements in mind). However, for embedded and data center developers, a whopping 75% and 86% of respondents “rarely” or “never” thought about energy usage requirements, respectively.
One interviewee explained why they rarely considered the energy usage of their software.
“Our main concern is market share and that means user experience is a priority. We can be more efficient to try to cut costs, but since we don't charge by energy used, cleaner code doesn't make us more attractive to users. We tend to focus on other things, such as performance or reliability.”
In other words, while coders say they are interested in writing cleaner code – and are often happy to use tools to boost its efficiency – they tend to perceive it as not worth their time and effort. They tend to put the blame on business process and client expectations that govern the companies they work for. In this regard, they are not dissimilar to people working in any other sector hoping to improve their sustainability.
So, what this paper can teach software and ICT companies is that before their developers can trim their digital fat, they must be properly incentivized to do so. It must become easier for them to write clean code than it is for them to be lazy.
Sustainable code will be a fitting feature of a website for a sustainability-related company. We worked with an air quality monitoring company called Kaiterra to create a very lightweight website.
How can engineers write eco-friendly code?
In an op-ed for the Harvard Business Review, researchers at global consulting company Accenture said encouraging cleaner code is a three-part process that begins by outlining a strategy and boundaries, which then targets the software development life cycle while encouraging the cloud to go green as well.
The boundaries are important, said the researchers, because there is always a trade-off between sustainability and business goals. By focusing on sustainability too much, the company risks losing its profits or generating a loss. That’s never a good thing for any business. So, the researchers said it's important to put clear boundaries on how far to go with sustainability practices.
The researchers added that setting reasonable but clear metrics to measure progress is critical for improving the sustainability of code. As the great businessman Peter Drucker once said, if it can’t be measured, then it can’t be managed. And with the trillions of possible data points generated every day online, the digital world is eminently measurable. There really is no excuse for poor metrics.
As already mentioned, since clean code can be split into two types – structural and behavioral – writing cleaner code should always keep the user experience in mind. After all, the more intuitive a website or application is, the less time an average user must spend searching for the right information or operating the hardware. And less time means more energy saved.
Another low-hanging fruit is to optimize all websites, software, apps, and tools for the specific devices that will be using them. Doing so will prevent developers from having to send unnecessary files to the device and to ensure the right amount of processing power is used by the intended devices to run the software.
Finally, by deploying clean code, software engineers can help uncover new business opportunities for a company, enhance the business’ competitive advantage, and contribute to a more sustainable world. It’s amazing what a little more effort can achieve.