Environment aware development

I must warn you, this post might contain ramblings of a mad man.. :)

I’m not going to debate wether or not we have a problem with regards to the environment, but one thing is for sure, we can all become better consumers and consume less. We, and then I mean everyone not only developers, tend to consume more than we need. For instance, when going into a meeting, everyone grabs a pen and some paper in case they want to make notes. Most of us don’t write any thing sensible, we doodle crazy drawings, play tic-tac-toe with ourselves or other participants of the meeting. On occasion we make a note of something and in many cases we don’t look at the note anymore. Of-course this is generalizing and hopefully not everyone does this, but I think a lot do. A better way would be to let one person take notes of the entire meeting, on a laptop even, and distribute this afterwards - digitally. I also see a lot of people printing emails and walking into someone’s office with the printout to discuss the content. There is something called the forward button. :)

One thing that would probably give even better results, would be to put your computer in sleep mode when you leave work for the day and have a scheduled task that wakes it up right before you get to work again (Vista only – read Sarah Perez’ recipe here). This is a pretty good option if you don’t want to shutdown completely. Going into sleep, all your applications are sleeping as well. When it’s waking up, everything is just the way you left it.

Now, what can we as developers do to be more environment aware? I know this is at best provocative for some; Write optimal code. Imagine if all the code all developers wrote was written to execute optimally on the processor and didn’t use more memory than it actually needed, then 640KB would actually be enough, just kidding. In fact, I think there could actually be an environmental upside if one were to start considering optimal code as a feature. We wouldn’t need all that RAM in our computers, for one. We wouldn’t need to scale into clusters or increase cluster sizes as often, which would lead to less hardware.  Most computer hardware is manufactured in Asia, they use a lot of coal to generate power there that the factories use, coal produce CO2 and is not cleaned as with modern coal plants. After manufacturing they need to package it. Products like RAM are often put inside plastic containers and these are then placed in larger cardboard boxes. After its been packaged, it needs to be shipped. This is usually done by boat, which has a CO2 footprint attached to it.

There are of-course economical consequences if people don’t need all that RAM anymore and RAM prices would go up. Other consequences such as they wouldn’t need all the factory workers, seeing that demand would go down. And most likely a bunch of other consequences. But still, it’s an interesting thought I think.

What do I mean by writing optimal code? Should everyone start writing native assembly language? That would be cool. Time to market would end up at a ten-fold of what we’re able to do today. This is probably not the solution. I think the solution lies within a couple of things. Writing optimal code does not necessarily mean that you’re going to spend a lot of time doing just that, but being aware of a couple of things might help you out and understand the platform the code is running on. With the knowledge of how the execution environment works and how the platform works, the developer has the power to improve their code from the first line one writes. In addition to this, one could use profilers to find bottlenecks in the code. Companies are too focused on getting stuff out the door as fast as possible that for instance the speed of a solution is often compromised. I think it is very important that when planning a project, one includes speed as a feature. Almost every user story/Scenario/Product backlog item should have a QOS (Quality of Service – MSF Agile terminology) attached to it stating the performance requirements. The same goes for memory consumption. Too often we see that developers use caching to overcome speed issues, resulting in heavy memory usage. I think that in many cases the speed issue could have been solved at a lower level if the developers had the time and resources (money) to do it. So in many ways, management and marketing must be willing to give the developers more time or cut back on the feature list and be willing to let the developers have speed as required feature. After all, the customers will be happier with a more responsive solution.

I realize that I’m not exactly going to change the world by posting this. I’ll probably just piss someone off instead, or be completely written off as an fool or something. But it’s a risk I’m willing to take. :) 

On a side-note, very much related though; I’m looking forward to the Performance by design using the .net framework that is one of the sessions for the pre-conference at PDC this year.

Have a nice weekend everyone. If I’m not put in a straightjacket during the course of the weekend, I’ll probably post something next week. :)

This post is licensed under CC BY 4.0 by the author.