Climate change is hard to solve because it's a global problem. It won't do if only one government implements green legislation, if only one energy company pivots to renewables, if only a few consumers reduce their energy footprint. Everyone has a part to play in the solution, including software developers.

Sustainable software engineering (SSE) is an emerging discipline that encourages developers to consider the environment as they write their software. It's at the intersection of hardware, software, climate science, and data center design, and is fundamentally about making applications sustainable without losing on performance, security, functionality, and accessibility.

SSE is important because software uses more carbon than you would think at first glance. When X-Team measured its carbon footprint in its 2019 financial year, over a quarter of our emissions came from the devices we use to write code and the data centers we store that code on.

Disclaimer: When we write "carbon", we don't just mean carbon dioxide (CO2). We mean all other greenhouse gases too, such as methane (CH4) and nitrous oxide (N2O). While there's less CH4 and N2O in our atmosphere, they're much worse pollutants than CO2. For example, one kg of N2O is equivalent to 298 kg of CO2.

How to Be a Sustainable Software Engineer

Microsoft has an excellent free course on sustainable software engineering, which we encourage you to take, where they introduce eight principles that developers can use to consider the environment when they write code. Most of their principles look at resource efficiency from different angles.

One of those angles is electricity. How much electricity does your software consume? After all, electricity isn't a clean energy source because most of it is still generated by burning fossil fuels (primarily coal and gas). As a result, software that uses less electricity is more sustainable because it won't indirectly require as many fossil fuels.

Of course, software always needs some electricity. Consider the carbon intensity of the electricity your software uses. Renewable electricity fluctuates based on the weather and the time of day. Make your software consume electricity when the supply of renewable electricity is high. This can be done through carbon intensity APIs such as this one for the United Kingdom.

But when renewable electricity is low, or when electricity demand is higher than supply, switch your app to an eco-mode that uses less electricity. You can do so by giving your users the option to switch or, the more aggressive choice, by not giving users the choice and simply doing it automatically.

Another angle to look at resource efficiency is through the hardware that your software runs on. How much does your software require from its hardware? The carbon it takes to manufacture and ship a smartphone, a laptop, a desktop computer, is called embedded carbon, and it accounts for a huge chunk of a device's lifetime carbon emissions.

The longer the lifespan of these devices, the better for the environment. That's why software that can run on all devices and doesn't require the most modern hardware is better for the environment than software that will make consumers want to buy new hardware because their old devices are too slow.

But for data servers, it's better to maximize utility. Servers that aren't fully utilized still consume electricity and still carry the cost of their embedded carbon. It's better for the environment to have one server running at full capacity than it is to have four servers running at a quarter of their capacity.

The final resource efficiency angle is networking. Switches, routers, and servers all have an environmental cost with their embedded carbon and the electricity they consume. The data that you send and receive across the network indirectly emits carbon. So try the minimize the size of your data packages and the distance they have to travel.

In Conclusion

Sustainable software engineering is a journey of many small steps. There's no immediate need to radically alter how you develop software, but it is important to at least consider sustainability when you write software.

Get the conversation going. Ask yourself if those extra database queries are worth the carbon, if you can compress your code into smaller chunks, and if you can adopt greener server architecture.

They may seem like small changes in the grand scheme of climate change, but everyone plays a part in the solution, and if we all work together, we can build a world where the software we write does not disproportionately tax the beautiful environment of our planet.