Hacker News new | ask | show | jobs
by gegeronimo 2055 days ago
I understand the author's point and I agree with it globally.

However, two major points are forgotten:

1/ clean code is about downsizing huge websites with millions or hundred of millions of users. Starting with your side-projects is a good way to learn to code clean.

2/ electricity consumption is not the right metric: the devices' time of life is. The heavier the code, the sooner we need to replace our hardware to keep up. It's both true on the front and the back sides.

Most of the CO2 and damages to biodiversity come from the hardware. The life time of a computer ought to be 15/20 years. With choice of high durability of components, repairs made easy, upgrades as well, plus second-hand markets: a gaming computer bought today ought to be an quite decent office computer in 15 years.

On the data centers' side, economic incentives are huge for operators to reduce energy consumption, both on servers and bandwidth. The gains have been incredible in the last ten years.

Maybe a server that Google wants to replace because its datacenter is full could be resold, maybe not to a competitor but to a family as a home central server. Running the family's NAS, media server and IoT hub.

To code clean is mainly a fight against hardware obsolescence.

Electricity consumption matters only for hugely used websites PLUS hugely-used frameworks like WordPress that run tens of millions of websites of smaller audience.

1 comments

> electricity consumption is not the right metric: the devices' time of life is.

I would even go beyond this: person time is the right metric. Code will be read many more times than it is written. Even if code is functionally equivalent and bug equivalent, the clean version will be easier to maintain, add features to, port, optimize and debug. Taking the care to craft clean code is worth it for this reason alone.