No Virgina, there is no such thing as Write Once Run Anywhere

I think the first time I heard “Write Once Run Anywhere” was the uscd-p system pascal.

From Wikipedia:

UCSD p-System achieved machine independence by defining a virtual machine,

UCSD p-System began around 1974 as the idea of UCSD’s Kenneth Bowles[1], who believed that the number of new computing platforms coming out at the time would make it difficult for new programming languages to gain acceptance.

Ok I was 10 in 1974 and probably wasn’t paying attention right at the start but its safe to say the idea has been around a long time. But read the article and weep about the fact that 37 years later we are still chasing (or hiding from) the same paper tiger.

Being cross platform is easy until you try to actually touch something about the platform. JNI anyone?

Its not just about companies trying to embrace and extend. Its just a hard problem and its everywhere.
Here’s a fun little PySide snippet adapted from some code which bit me yesterday.

from PySide.QtCore import QSettings
settings = QSettings('foo','bar')
settings.setValue('key',False)
a=settings.value('key')
if a:
    print "Windows"
else:
    print "Mac"

So this will print Windows on Win7 and Mac on Snow Leopard. The reason is apparent if you add this line:
print a, type(a)

On Win7 you get:
false <type 'unicode'>
On the Mac:
False <type 'bool'>

Ok so maybe you think the Mac is correct and the Win7 version of PySide has a bug. Doesn’t matter. The worst part is you can “fix” this by changing:
settings.setValue('key',False)
to
settings.setValue('key',int(False))  # or a var which is <type 'bool'>; with a value of False

And it all works. The windows registry (in PySide’s world at least) seems to understand Ints but converts bools to strings. Yay!

Of course we can all think of other examples. The point is just to remember that there is no cross platform development environment and there is unlikely ever to be one.

For a while people wanted to think that the Web was the answer. You know make some cool web app and if you obey the standards it will work for everyone without any special hacks. Ha. Good one.

With current trends in Virtual Machines, I think Write Once Run Anywhere might happen because we will just ship the App as a complete Virtual Machine and the OS will just be something like VMWare with a switcher. Then the switcher will get more and more complicated and there will be competing companies making them. Each will add their own features to differentiate themselves until…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>