Green coding - SuSE: From code bloat to supreme sustainability

This is a guest post for the Computer Weekly Developer Network by Vishal Ghariwala, senior director and CTO for Asia Pacific region at SuSE.

Ghariwala writes in full as follows…

When I was a Java developer in the early 2000s, we were still living in a proprietary world and the majority of code was closed-source.

With reusable code hard to come by, I was forced to write much of the code for the applications I was building from scratch.

I even went as far as pulling code samples from IT books and journals such as Dr. Dobb’s Journal!

(Ed: Nothing wrong with that Vishal, some of our team used to work there 🙂 

Today however, open source is the dominant way of building software. Code is easily available on the internet for almost anything. While this means more efficiency, it can also contribute to code bloating.

Code-reuse

For many developers, coding revolves around a reuse or ‘copy and paste’ culture.

However when you copy code, it’s not just the code that you are copying.

#You will also be inheriting its inefficiencies. You will often need to integrate additional libraries and frameworks to support the copied code, even though you may utilise only a small part of what these libraries and frameworks offer. All this introduces considerable bloat into your application, causing it to use more compute resources.

The technical debt that you incur in application performance as a result of copying code could be amplified significantly in a cloud-native world. Imagine a bloated microservice that needs to scale across 100 Kubernetes pods. The additional compute resources required for inefficient code will be multiplied by 100 times! And if this is going to be a shared microservice that will be used again in other applications, your technical debt increases even more.

To prevent code-reuse from causing bloated code, developers can adopt practices such as conducting regular code reviews and refactoring code to remove unnecessary code fragments.

Leverage efficient platforms

Code-reuse is not the sole reason for inefficient code. A car manufacturer can build a high-performance sports car. However, if you drive it on a rough road with potholes, the driving experience is going to be quite inefficient. Green coding is not only about reducing code bloat and writing highly performant code.

It also emphasises adopting the right development methodologies and platforms that minimise energy consumption and promote environmental sustainability throughout the software development lifecycle.

For instance, developers should choose the most appropriate and efficient frameworks and platforms for their code. A notable example in the cloud-native domain is Kubernetes. While Kubernetes is popular for general purpose cloud-native applications, it is not ideal for IoT/IIoT and edge-computing use cases, where the rapid proliferation of devices and nodes can lead to substantial energy consumption and environmental impact. For such use-cases, energy-efficient alternatives should be considered.

One such example is K3s, a certified lightweight Kubernetes distribution built for IoT/IIoT and edge use cases.

A collective responsibility

Vishal Ghariwala is the senior Director and chief technology officer for SUSE in Asia Pacific.

Green coding is a collective responsibility, but platform engineering is here to the rescue.

Software development today is radically different from what it was 10 or 20 years ago. Now, developers are expected to practice polyglot programming, be proficient with the popular cloud providers and cloud-native tools, ensure that their code is free from security issues and by the way, also write code that is green. That is a significant amount of responsibility on the shoulders of developers.

How can other parts of the IT organisation support development teams?

This is where Platform Engineering teams can play a pivotal role. They can provide a curated and shared list of efficient code templates, libraries, frameworks and APIs through a standardized and centralised platform such as Rancher.

By doing so, we embed guardrails into the software development process, ensuring that developers are accountable mainly for the efficiency of their code. The platform engineering team will be responsible for the shared assets and tools on the centralised platform.

Code reuse is inevitable in today’s times.

By embracing coding best practices, selecting the appropriate platforms, and fostering a culture of shared responsibility for green coding, organisations can pave the way for sustainable software development.

About the author

Vishal Ghariwala he engages with customer and partner executives across the Asia Pacific region. In addition, he is responsible for growing SUSE’s mindshare by being the executive technical voice to the market, press and analysts. Vishal also has a global charter with the office of the CTO to assess relevant industry, market and technology trends to identify growth, partnering and M&A opportunities. Prior to joining SUSE, Vishal was the director for cloud native applications at Red Hat where he led a team of senior technologists to drive the growth and adoption of the Red Hat OpenShift and middleware portfolios. Before that, he spent a significant amount of time with leading middleware vendors such as IBM, ILOG and Intalio, as well as the public sector.

Vishal has over 20 years of experience in the IT industry and holds a Bachelor’s Degree in Electrical and Electronic Engineering from the Nanyang Technological University in Singapore.

 

 

CIO
Security
Networking
Data Center
Data Management
Close