We all know how to do our bit to reduce our CO2 emissions, from wearing a coat instead of turning on the heating, to walking or taking the bus instead of driving. But we often forget about our tech. New, fancy technology is growing in demand and function at a massive pace.
Yet while it’s clear to us that walking instead of driving reduces emissions, the energy consumption of our technology is less obvious. And it’s substantially bigger than you think. Bitcoin alone stands to use 0.5% of the world’s energy consumption this year, making its daily use a ‘bit less than the energy consumption of Ireland’.
So, in the pursuit of both better tech and reduced energy consumption, how can we use and change the way we code to combat climate change?
Energy consumption of the tech world
With the battery power of our devices, the energy needed to read code, and the storage and retrieval of data, our daily technology use takes a lot of power. In fact, the IT industry consumed 3-5% of the world’s electricity in 2015. By 2025, it could be using 20% of all electricity, and emit up to 5.5% of the world’s carbon emissions. That’s a monstrous amount, and not good news for the environment.
So, what makes the energy appetite of our tech so insatiable? The answer lies in data, and the way that our code needs to be read. Whether it’s a website, a software program, or data stored on the cloud, the bowels of the technology we use require constant (and enormous) electrical feeding.
In fact, data centers currently have the same—and potentially higher—energy consumption as the aviation industry, and it’s set to triple in under a decade. To add salt to the wound, our devices are only getting more energy-demanding and more widely used. There is already an expected 20% increase in demand for fancy tech. That means more devices, all requiring more energy and all adding to our CO2 emissions.
The energy reliance of our tech means more fossil fuels burnt. Technology use, then, comes with a weighty carbon footprint and a sizable contribution to global warming. So, along with switching our energy sources from fossil fuels to renewable energy, we need to find ways to reduce the energy consumption of the technology we so greedily consume.
Reducing code energy consumption
Reducing the energy consumption of code helps tackle the problem at the source. The way we code could be a way to help combat tech energy consumption, and so climate change. Plus, increasing battery life will improve the user experience.
Things like endless null checking and messy spaghetti code increase the power consumption needed to use code. By reducing these as much as possible, you make your code more sustainable and easier to maintain. In other words, ensuring your code is as simple, efficient and easy to read as possible can reduce its energy appetite.
There are a few ways you can start to do this. You could write negative code, a practice that involves reducing the lines of code in your software while improving its quality and sustainability. This encourages meeting essential complexity: finding the shortest and simplest way to write something.
Negative code also means you’re creating less code that will need reading. So, less energy will be needed to run the code. In cases where running the program requires the code to be repeatedly read by a machine, for example, less code can mean faster loading times and reduced power consumption.
Code refactoring is another way to support sustainable code creation. Code refactoring is a process where code is restructured without changing the external behavior. It’s useful for keeping code tidy and enhancing both the maintainability and usability of the software components. Because code refactoring improves code maintainability, you reduce the risk of spaghetti code, meaning you also reduce the risk of your code demanding excessive energy consumption.
Incorporating sustainable design
Then, there are design choices you can make to improve the sustainability of your websites and software. As a bonus, many of these can also improve the user experience, with fast loading times and ease of use.
When your content is easy to find and your software easy to use, less energy is consumed by users searching for the information or function they want. Improving your content’s findability, then, can make your code less greedy for energy. On your website, this can be achieved with clearly labelled menus, helpful subcategories and an easy to access search function. For your software, findability means making your features and utility as intuitive to find and use as possible.
Optimizing for speed can also reduce the energy consumption of code. On a website, enabling browser caching to reduce how often your code is downloaded is a great start. Another easily achievable step is optimizing your images for low data use, meaning that less energy is used to retrieve website data.
You can reduce the energy appetite of your software meanwhile, by removing unnecessary elements and actively avoiding feature creep. (Adding extraneous features that aren’t helpful to your users.)
Paint the tech world green
We already turn our lights off, reuse our plastic bags and recycle. These are all small actions – little things that add together to make a big difference. Coding with energy consumption in mind is another small thing we can do that stands to make a big difference.
So, make the little changes you can to combat climate change with your code. You’ll improve the user experience and could help to make the tech world a slightly greener place.