The Business Value Behind Green Coding

Most large businesses – and many smaller ones – now have a sustainability strategy. Measuring Environmental, Social and Governance (ESG) impact has been transformed from a fringe activity into a fundamental differentiator.

That’s partly because organisations want to do the right thing – climate change affects everyone, after all – and also because sustainability makes sound business sense.

B2C businesses are dealing with increasingly environmentally aware consumers. B2B businesses are selling to companies with their own ESG and sustainability targets. Large organisations of all kinds need to green their supply chains as well as themselves.

On top of it all, regulation around ESG is only going one way. Progressive companies are fighting to get ahead of the curve. As far as non-compliance is concerned, prevention is better than cure.  

In which case, how might organisations achieve greater sustainability? There are many ways, but in a digital world green coding is an increasingly essential ingredient in any corporate sustainability strategy. It can also provide a range of other business benefit.

IT energy consumption: the elephant in the room 

According to the Association for Computing Machinery, energy consumption at data centres has doubled in the last decade. The ICT sector is responsible for between 1.8% and 3.9% of greenhouse gas emissions globally. 

That should come as no surprise. The expansion of our digital horizons in the last ten years or so has been remarkable. Every business is, to some degree or other, a digital business. 

Digital-first organisations create vast amounts of data, and then set powerful new technologies to work, analysing it for insight. AI, analytics, the IoT, VR…they’re all changing the world, and adding significantly to its energy consumption.

The need for green coding in a data-hungry world

The direction of travel here is only one way. The explosion in data is ramping up energy use in data centres, raising costs and making sustainability targets more difficult to achieve.

Source: Statista

At the same time, the vast expansion of computing power over the last couple of decades has created a sense of freedom among software engineers. As technology constraints have diminished, code has become longer and more complex. Coders have worried less about the process and more about the outcome.  

To take one example, open-source code libraries have allowed programmers to reuse pre-produced pieces of code in their projects. This can certainly be useful, accelerating time to market for under-pressure projects. And as we all know, recycling can also be sustainable, when it’s the right code for the task. 

But often it isn’t, or at least not quite. An ‘off-the-shelf’ approach to software engineering – when code is reused simply to cut development time – can result in more lines of code than is necessary. That in turn requires more processing power and demands more energy use.

In addition, the almost limitless computing capabilities that modern developers have at their fingertips have led to major leaps in file size. Why reduce image or video quality, even fractionally, if you really don’t have to?

This is all in stark contrast to the coding practices of the early years of the 21st century when technological limitations demanded greater coding discipline. 

Green coding is many things but one of them is a return to coding with stricter limits and a focus on taking the shortest possible path to a desired outcome.

Source: OurWorldinData.org

Lean coding is green coding

In other words, to reduce energy use in software, applications and websites, programmers are adopting the principles of lean coding. 

In short, this means writing code that requires less processing power without compromising quality. This is a win-win, because when it’s done well, lean coding can have business benefits beyond contributing to sustainability targets. 

Efficient, purpose-built code can accelerate applications and improve user experiences. And because it uses less energy, it can reduce energy bills. 

There are some easy wins in this. Many – perhaps most – file sizes can be reduced. Coders need to recognise where high-quality media is necessary, and where lower-quality alternatives will do just as well. There is a balance to be struck.

Similarly, writing tight, tailored code will increase efficiency and lower energy consumption. And because efficient code takes less time to process, it’s also likely to produce better results.

Writing good code leads to better user experiences because applications are faster and more efficient. And focusing on user-friendliness is also a principle of green coding. 

Applications that are more intuitive mean users spend less time doing what they need to do. The more user-friendly software is, the more energy efficient it tends to be, too.

The importance of language in green coding

In all this, your choice of coding tools takes on new significance. Some languages – Elixir is one – are designed with efficiency in mind. That tends to mean the software they produce uses less energy as well.

Elixir, which is based on Erlang, is a lightweight language, consuming relatively little in terms of memory or processor power. It’s often the most sustainable option in places where many processes happen at the same time, such as a web server.

Because it utilises the Erlang Virtual Machine (VM), Elixir is ideal for running low-resource, high-availability processes. It’s also simple and easy to understand, requiring less code overall than many counterparts. That makes the end application more sustainable, and it also reduces the number of computing hours needed in its development.

Elixir is written in clear, easy-to-understand syntax, so it’s easy to maintain and update as circumstances demand. In addition, comprehensive in-built testing tools make it easier to write code that works first time – another sustainability win.

Sustainability and business value

In other words, in the right circumstances, Elixir is an excellent tool for writing lean, well-tested and readable code, which is as energy efficient as code gets.

And as we’ve seen, the business value of green code goes beyond ESG compliance. It can lower bills. It also shows customers, prospects and potential employees how seriously your organisation takes environmental responsibility. 

Lean programming tells the world that your green commitment is far from just skin deep. It reaches the core of your infrastructure.

Sustainability targets will only become more stringent as net zero deadlines inch closer. The code that runs our digital world will play a significant role in creating a leaner, greener future. Businesses that adopt green coding now can gain a competitive advantage.
For more information on Elixir and how it can help green your development processes, please drop us a line.

Keep reading

MongooseIM 6.3: Prometheus, CockroachDB and more

MongooseIM 6.3: Prometheus, CockroachDB and more

Pawel Chrząszcz introduces MongooseIM 6.3.0 with Prometheus monitoring and CockroachDB support for greater scalability and flexibility.

Why you should consider machine learning for business
thumbnail image of machine learning for business

Why you should consider machine learning for business

Here's how machine learning drives business efficiency, from customer insights to fraud detection, powering smarter, faster decisions.

Implementing Phoenix LiveView: From Concept to Production

Implementing Phoenix LiveView: From Concept to Production

Phuong Van explores Phoenix LiveView implementation, covering data migration, UI development, and team collaboration from concept to production.