The Green movement is oh-so-popular these days. I wonder how far we can take it.
Over a great beer the other day, I was talking to a Prius-hugger about creating a smaller carbon footprint. As he droned on in his self-gratifying manner about how he was saving the planet, my mind drifted towards applying those same green principles to coding. That is, an approach to building software that is so lean & mean that it sucks up magnitudes less computer power. On the web especially, this could really have a significant effect. Imagine if every single Myspace page used half the computing power to render. On the client side, it wouldn’t do much — although if you multiply that across hundreds of millions of pageviews, then the impact would be impressive. But on the server side, I’m sure the differences would be amazing. Servers could probably even be decommissioned. Entire data centers might utilize less power based on changing a few lines of code.
Would anybody adopt this coding style? Programmers are notoriously resistant to change, especially when that change is forced upon them from management. They have to be that way to be able to meet tight timeframes. If a coder needs to make a quantum shift in thinking to simply architect a new project, that is going to slow them down unacceptably. Oh, and they’ll be cranky too.
So maybe this green coding would be taught at the college level, making it innate for programmers. No change necessary. Professors are idealists generally and would love this sort of methodology. It hearkens back to the old days of lightweight coding when every line counted. In fact, there was a physical limit to how big your program could be. I remember hacking out entire chunks of code so that my early projects could fit on a 5 1/4″ floppy disk. The professors’ teaching assistants would assign better grades for actually using less lines (although it helped to be really wordy with your comments, so that they would have less to look over). And the professors, off on sabbatical or whatever, would smile smugly to themselves in awe of their incredible teaching skill since nobody had handed in a final project that was over one floppy disk in size.
When I learned to code, 4 megs of memory was an awe-inspiring luxury and processors crawled along at 5 Mhz. Remember the Commodore 64? The “64″ stood for 64 kilobytes of RAM! Programmers had to be very careful about resource usage otherwise the entire computer would crash. Luckily things went steadily downhill after that.
As Windows and other memory hogs came about, computers strove to keep up with the ceaseless demand for more and more power. Developers cared increasingly less about creating tight, lean code. What we have now (with Vista, Photoshop CS3, etc.) is just massive, massive code bloat. And there’s no way around it. In the rush to meet deadlines and get products to market, you can’t spend months and months optimizing code for speed. Besides, by that time, computers will probably be fast enough or memory cheap enough that the fatter application won’t matter (at least that’s what Marketing says).
Moving apps from the desktop to the “web-top” (i.e. web-based software like Photoshop Express and Google OS) seems on the surface like a reasonable solution. But that just shifts the resource usage from the client to the server. It’s the same obese app, using the same power, but now it’s running in a data center instead of on your box. But at least you’re not paying the electric bill.
Truly, the only way green computing can be accomplished is at the code level and it must be taught in universities and junior colleges. Anyway, it’s a worthy goal, for sure — one that deserves more thought from you and from me as to how it can be accomplished. By the way, this whole train of thought had the added bonus of getting me through a tremendously boring conversation with a holier-than-thou driver. But the beer was sure good (Lagunitas India Pale Ale).