Monday, February 14, 2011

Script Apps In Smartphones Considered Evil

One of the virtues of Linux - that anybody can write their programs any way they like - can become a detriment in the limited resources of the Android environment over the long term.

Consider SL4A (Scripting Layer for Android). It provides a way for developers to write Android apps in scripting languages like Python, JavaScript and JRuby. If the programmer chooses to write their application in Python, then what happens in the phone? The script is interpreted by Python running in SL4A running in Java in Android. All of the dependent libraries have to be loaded. Look at all that RAM being used! The script gets interpreted, converted to Java API and run on the native OS. That's 3 layers over top of the native OS. Look how slow that executes! If, over time, the user downloads several apps, all written in scripting languages, and runs them, there may be interpreters for Python and Lua and Perl all loaded - a huge demand for RAM and execution time. Will the thing thrash memory? Yeah.

The phone makers will compensate for this with more RAM and faster CPU's. That will mean more energy consumption, less battery life or bigger batteries, more weight and more heat.

From the usability perspective, to support scripted apps, the users have the extra complication of having to download the software dependencies. Because the supporting libraries and interpreters have to be installed, the storage fills up.

For the sake of the user and the ecology, write your apps as close to the metal as you can!

(I won't say browser apps are as bad, because the browser is already in the device)