Green Coding: The Secrets to Unlocking More Sustainable Software Engineering
We’ve reached a number of tipping points when it comes to irreversible climate change. That’s according to a 2022 report released by the Intergovernmental Panel on Climate Change (IPCC). In fairly blunt terms, if urgent action isn’t taken to reduce greenhouse gas emissions, our planet and the long-term sustainability of our ecosystem is in grave danger.
While there’s broad support for reversing the conditions that have led us to these tipping points, many businesses face considerable challenges in reducing their carbon footprint and developing more sustainable ways of doing business—and many wouldn’t even think their software could be part of the problem.
Green software (also known as green coding, green computing or sustainable software) is a concept that’s been around for a few years. Its focus on minimising environmental damage through engineering is attracting significant interest among architects, developers and coders wanting to make a meaningful, long-term contribution to saving the planet.
In this blog, we’re going to look at the emerging concepts and principles that enable Green Software Engineering. We’ll dive into the best measurement tools, a model that brings greater understanding of the inclusive nature of Sustainable Software Development, as well as highlighting the three emissions scopes defined by Greenhouse Gas Protocol (GHGP).
What Is Green Software Engineering?
Green software engineering is a design concept that says software should be developed and used efficiently and effectively “with minimal to no impact on the environment”.
It includes all facets of a software product’s lifecycle including its design, use, economic, social and ecological impacts. Because of this, green coding has the potential to play an important role in minimising carbon emissions and improving sustainability programs in small, medium and large businesses.
Green software prioritises the following design, development and implementation principles:
- It should limit energy consumption
- It should limit its environmental impact
- It needs to include green and sustainable software development practices
- It must include green and sustainable architecture and hardware
- It should reduce greenhouse gas emissions and carbon footprint
8 Green Coding Principles
Sustainable software development has traditionally focused on cost, speed and agility rather than its potential to minimise emissions and improve sustainability.
A coordinated effort to agree on a global set of principles and standards for green software has only recently gained momentum through the Green Software Foundation; a non-profit organisation established in 2021 aimed at developing a network of "people, standards, tooling and best practices for green software”.
The Foundation has developed what’s become recognised as eight fundamental principles for guiding software engineers in their approach to software development. These eight principles of green coding are:
- Carbon: Build applications that are carbon efficient
- Electricity: Build applications that are energy efficient
- Carbon Intensity: Consume electricity with the lowest carbon intensity
- Embodied Carbon: Build applications that are hardware efficient
- Energy Proportionality: Maximise the energy efficiency of hardware
- Networking: Reduce the amount of data and distance it must travel across the network
- Demand Shaping: Build carbon-aware applications
- Measurement & Optimisation: Focus on step-by-step optimisations that increase the overall carbon efficiency.
Further information on each principle can be found here.
2 Green Software Engineering Philosophies
The principles of green coding are underpinned by the two philosophies of green software engineering:
- Everyone has a part to play in the climate solution: Nothing happens in isolation, everything is connected, and small changes lead to big changes.
- Sustainability is enough, all by itself, to justify our work: Sustainable applications are almost always cheaper, are often more performant and often more resilient.
Sustainability in the Cloud: How to Leverage Google Cloud to Grow Into a Greener Business
The pressure on for consumers and enterprises to do more in the space of sustainability.
In this eBook, we’ll look at GCP as a leading cloud provider and how to use it best to achieve your sustainability goals.
Measures and Models for Green and Sustainable Software Development and Practices
There are no one-size-fits-all approaches or tools for measuring green and sustainable software practices. With this in mind, it’s important that your metrics provide insights that are relevant to your organisation’s sustainability targets.
1 - Understanding Your Environmental Impact in the Cloud
All the major cloud providers offer tooling and dashboards for understanding the impact of the services that you consume through their platforms:
While important, these platforms only look at the resources that software workloads run on, and therefore aren’t strictly measuring green software development and the complete sustainability measurement of a software product.
2 - Using Sustainability Dimensions to Measure How Green Your Software Is
A useful model to facilitate a broader understanding of your software’s sustainability is discussed in the paper ‘Green measurements for software products based on sustainability dimensions’. This model is far more representative of a complete ecosystem in the context of social, economic and environmental factors. It’s also one of the more modern understandings of green and sustainable software.
Diagram 1 - The relationship of sustainable dimensions and measurements for green software (Adapted from Raisan et al 2022 Green measurements for software product based on sustainability dimensions)
Implementing sustainability measures and models doesn’t need to be complicated. Modern software development already benefits from lean, agile and resilient approaches; adding the green dimension elevates software development as a thought leader in the modern day quest for visibility of sustainability and climate impacts.
3 - Measuring Emissions Using the Greenhouse Gas Protocol Framework
Having observability of your software’s performance is a core requirement in the modern approach to software delivery for engineers.
Measuring the actual carbon footprint of software is very difficult because there are so many variables to contend with in the lifecycle of each element (e.g. clicks per user on a particular web element). This makes it incredibly difficult to understand the real carbon output given the amount of indirect and direct sources of carbon along the chain leading to a user clicking on a website.
The Greenhouse Gas Protocol (GHGP) is a globally accepted standard that provides guidance and a standardised framework for measuring, accounting and reporting their emissions. This framework can also be adapted, or at least be considered, by software development teams.
At its core, the GHGP categorises emissions into three scopes:
Scope 1 - DIRECT
- emissions from sources owned or directly controlled by a company.
Scope 2 - INDIRECT
- emissions from the generation of purchased energy
Scope 3 - INDIRECT
- emissions that occur outside of Scope 2 in the value chain including upstream and downstream emissions.
Software development would typically have lower emissions in the Scope 1 and 2 categories, with the majority of emissions coming through Scope 3. However, it would be incorrect to assume that, given the majority of emissions are indirect through Scope 3 upstream/downstream value chain inputs, the software development team shouldn’t contribute to the solution.
However, it is advised to proceed with caution when going green with software.
The Cost of Going Green
Sometimes, the very act of going green can be more costly, so there is a balancing act that needs to be considered when making software sustainable. Typically the more efficient the software, the less the carbon footprint will be—and yet the very nature of making software efficient can cost more over a period of time. Additionally, many of the world’s IT systems still draw on carbon-heavy sources of power because carbon remains cheaper than ‘greener’ energy sources.
To shift the priority to green and sustainable software development, we require a change in thinking. Small changes and adaptations over time can have a significant and lasting impact. For development teams, a great place to start is with their own ways of working.
4 Ways to Achieve Greener Ways of Working
1 - Green Thinking
Thinking green can be introduced into modern ways of working with relative ease. To increase mindfulness of sustainability, a software development team might like to introduce ‘green’ thinking and practices across all aspects of their delivery.
Just remember, being green and sustainable is not just about the code or the environment on which it runs!
Think about a large, distributed team and their own effect on the environment. Is it really necessary for the team to ‘burn carbon’ by driving, flying or public commuting to meetings, events and showcases as part of their software development? Do they really need 30 tabs open in their browser while developing? Printing should also be kept to a minimum or discouraged.
2 - Measure and Monitor
Completing a sustainability estimate for each feature at the beginning of its journey, and then measuring the actual sustainability as it progresses to production, may actually yield results for other more traditional metrics (cost, cycle time, usage) that weren’t taken into consideration in earlier design and development phases.
Having green and sustainable development practices are vital—not just for the end product but as a means for actual development.
3 - Automate
Automation can be a real value-add when it comes to green development ways of working. Spinning up and shutting down environments, and processes for cleaning up and minimising code repositories, are all part of a developers effort to be green and sustainable. Even the simple act of completing a sustainability review and preview during each release cycle may just be enough to kickstart the journey to green and more sustainable software.
4 - Be Mindful
Bear in mind, greener ways of working are everyone's responsibility and not just limited to the designers, developers or delivery teams. As we see more and more in today’s world, being green is a powerful marketing tool that can dictate attitudes to your product and/or service, influencing both customers and employees alike.
It’s time to take the threat of irreversible climate change seriously. Green software engineering and sustainable software development are emerging practices that can have a meaningful impact on our society and the living environment that surrounds us.
Because we all have a part to play, starting a conversation in your next team meeting, scrum or roundtable about adopting the eight principles of green coding is a simple but important step that you and your team can take to play your part in creating a more sustainable planet for generations to come.
It’s a small change that can go a long way to helping shape a better future.
If you want to think more on sustainability, check out our eBook: ‘Sustainability in the Cloud: How to Leverage Google Cloud to Grow Into a Greener Business’ or feel free to get in touch here!
- ARTICLE: Green measurements for software product based on sustainability dimensions
- ARTICLE: The GREENSOFT Model: A reference model for green and sustainable software and its engineering
- ARTICLE: Integration of Lean, Agile, Resilient and Green Paradigms in a Business Model Perspective: Theoretical Foundations
- BLOG: What is green software?
- BLOG: What is green software? (Green Software Foundation)
- BLOG: Principles of Green Software Engineering