Skip to content
Domain Specific Language

Thoughts on ethical software

The major cloud actors have all stated that they will be some combination of carbon neutral, carbon free, and carbon negative at some point in the future.

Not everyone is a cloud vendor! What can a software developer do today to improve the future of the planet?

Software in the cloud

I will give high level advice, to the best of my knowledge an experience, if I were to create new software today.

Software development tools

Software should be easy to make and easy to deploy. But also resource efficient and correct. Starting a new project in a programming language like C, Python, or Java today is probably not a good idea.

C is fast and uses few resources, but is notoriously hard to make correct.

Don't use C.

Python is correct in the sense of "no undefined behavior", but is hard to manage in large codebases. It's not fast, and it doesn't exactly shine in resource usage with 75.88 times more energy usage and 2.88 times more memory used compared to C in a number of benchmarks. Python also relies heavily on C and C++ to make e.g. math libraries faster.

Don't use Python in anything but local scripts and prototyping.

Java is easier to maintain than Python, but still has null pointers all over the place. It has just 2 times as high power usage, but a whopping 6 times higher memory usage compared to C in the same benchmarks.

Don't start any new projects that run on the JVM.

I don't mean to pick on e.g. Java per se, but creating a somewhat complicated application using a popular framework like Spring Boot will require you to have access to at least a few hundred MiB, probably more to keep everything humming along when there are a lot of connections.

Rust is the only programming language that gives the level of confidence needed for high productivty. It's the programming language with the highest level of correctness in combination with super low resource usage.

Running software in the cloud

When creating new things to run in the cloud, they should absolutely not be deployed as always-on VMs. The exception is software running around-the-clock, non-stop at high loads, and software that can't be deployed any other way like some relational databases.

An always-on service gives you slightly lower latency at a huge monetary and environmental cost. You are locking down several gigabytes of RAM and a number of cores, that will do literally nothing but take up space in a data center somewhere. Not only are you giving your cloud provider money for doing nothing, you are forcing them to buy, maintain, and power on more computers than necessary. Even a few percent fewer total computers are a lot of computers in a huge data center.

Unless you have a process where starting and tearing down VMs or containers is easy, the only technology you should use is serverless, or ephemereal services as they should have been known. Amazon has AWS Lambda, Google has Cloud Run, Azure has Azure Functions. All of the mentioned products support Rust.

Always deploy to a serverless environment unless there is a really good reason not to. And only deploy to a serverless environment that supports Rust.

Moral imperative

There is more to ethical software than just making code that generates as little waste as possible. Other human beings are also a huge part of the equation, and I might write about that in the future. So let me end with a Top 3 of helpful tips.