Java is bad for you and the world around you !

Java is bad for the environment and you should feel bad if you program in Java!

Java. Java the programming language.
So Java was developed to be (WORA) “write once, run anywhere”. Concept that would allow developers to write programs to run on any platform. Developed in 1995 by Sun and later acquired from Oracle, it got some very nice ideas and huge contribution to the computer world. BUT, right there in the beginning we have serious concept problem that even 25 years after we are not near to solve. The “write once, run anywhere” concept is a delusion and every programmer who tried to deploy to multiple platforms knows that! First of all every platform is created around a specific idea, with specific features. The only thing that happens when used is that the programmer end up writing more code to check for the device in use and execute the code for that specific device, which is always more troublesome and time expensive than to write a standalone application for that device. Anyway, Java have done some great work in trying to implement that concept and have lay the foundations for something that we see today like HTML5/JS application apps that are multiplatform.

Let’s get to the real problem of Java and why Java is bad for the environment.

So to let Java be (WORA) developers created the so called virtual machine. That is a layer, a program that translates and communicates between the hardware and the Java code. Which for development is perfect and for production is a disaster. But why is that? Well first of all, you rely that the virtual machine will be well optimized for the specific hardware and if it’s not you can`t do much about it. The virtual machine will always need extra resources from the RAM and CPU. And last but not least, you will always have lag in the executed code. It is quite obvious right from here that it should be not used in mass production, the main idea of technology and modern world is to optimize its use or resources, time and cost and virtual machines are exactly the opposite.

But what that have to mean to the end user and what that have to do with the environment.

Well really nice example is the Android based phones. Google rushed to intervene in the market with Android, because it allowed them to have their platform running on many different manufacturers using different platform. That gain them huge advance and market share. But it is not right. It is huge step backwards in the morale and the esthetics of programming and it is promoting concepts that are bad for production. End users soon realized that the operating system was slow, crashing, irresponsive and not really pleasant for everyday use. So what was the response? Well Google didn’t have to answer for that. So manufacturers pour money in hardware. So now they start buying huge quantities of Silicon to produce more chips. Single core wasn`t and option and 1 GB of ram is not even near for that what was needed. And with that comes higher energy consumption. So we have performance, but soon the end user realized that they could not use any of their Android devices for more than half a day. So again manufacturers have to pour more resources in their devices. So they start expanding their batteries with more lithium.

And here is where really the usage of Java programming responsible for the environment.

Android phones became more energy demanding than any other. And right now 6-core CPU is something essential to get average user experience.
In contrast Apple started using Dual-Core processors as late as IPhone 4s in 2011 and 1 GB of ram as late as IPhone 5 in 2012. That is because they use native compilation of C and C as architecture. Even better example is Microsoft Windows Phone which is created to be multy platform OS, again written in C, it runs flawless on 1.4GHz Scorpion CPU, 512 MB of RAM in 2011.

It is estimated that there is (29.3 %) percentage higher energy consumption between Java and C based phones, which are IPhone 5 and Galaxy S3.

So think it this way, if you program in Java you use more resources, at least because of the Virtual Machine that you need to use and if you plan to deploy your code in mass production it will definitely effect energy consumption.

And for final words, I leave them to Linus Torvalds :

Environment, Programming, Uncategorized