Jan Jongboom - Cloud9 keynote
Keynote during the Plone Conference 2012.
This is a talk from the Plone conference 2012.
Jan Jongboom from Cloud9 talks about Javascript.
In 1995 Livescript appeared, developed by Mozilla. A simple scripting language. They called it Javascript, though it was not really like Java at all. It was more like Scheme.
In 1999 Microsoft wanted to build a web version of Outlook 2000. At that point it was not possible to send data from the client to the server without refreshing your whole page. So the XMLHttpRequest was born. This means you can have asynchronous applications.
So Google wanted to build something cool as well. So they launched Gmail in 2004.
Javascript did not get a lot of love in Plone in the beginning. A problem was that there were lots of difference between the Javascript implementation of browsers. The book 'Javascript, the good parts' is eight times smaller than the definitive Guide to Java.
In 2004 (?) JQuery got launched. Maybe the most popular library ever. The power comes from Sizzle, which allows you to easily select DOM elements on your page.
From about 2010 Javascript got more popular than Java, according to some definitions. People started to care. VMs got faster and embeddable. Ecmascript 5 got introduced.
In 2009 the JSConf was the first conference completely about Javascript. NodeJS was introduced at that conference. It allows you to use Javascript on the server. You could think: "Ah, nice, Google's V8 engine as an executable." But it is more powerful than that. LibUV is in there. It abstracts hardware differences away. You would want code to work asynchronously, and operating systems do not normally work that way: you get a file and once you have the data you continue. With LibUV you get events on files, networking, DNS, etcetera: once data starts flowing in, your method gets called so it can continue its work.
Threads can easily get blocked by IO operations. You have a powerful server but due to this, you may still be limited to 300 concurrent connections (if your thread uses ten MB of memory and you have 3GB of memory), or 300 users logged in to the system. With non-blocking threads you can handle tens of thousands of connections.
nodeJS is the Javascript bindings to LibUV. You use standard libraries in Javascript. This Javascript code is then executed in the V8 engine.
Couldn't you use Twisted, the asynchronous Python framework for this? Why would you choose Javascript over Lua or Python or C++? Most Python code is not build to be used asynchronously. In Javascript it is normal.
So we decided to build Cloud9. For most programming languages there are debugging tools and good syntax highlighting. For Javascript: not so much. Cloud9 is an online tool that can do that. You can download it and install it on your server. We give you a free Linux VM with a real terminal. The coolest feature is collaboration. See your colleague type. Debug together.
In our data center we only have Cloud9 code, our IDE server. In another part of the data center we have the remote VMs. We ship it with Python 2.6.6, but you can compile 2.7 or 3.3 on it. You can run MongoDB or Postgres on it, or whatever you want, like Plone. I had problems with it, but you should be fine.
If the standard VM does not have enough power (OpenShift, 128/512 MB Ram, limited resources), you can bring your own VM. I tried the Plone UnifiedInstaller on an Amazon ec2 machine, which I will demonstrate now, if the wireless connection is working good enough. Otherwise a video will have to do. You will see a collaborative session in two browsers where a Plone instance is started and I get a co-worker to assist me on that same machine in his own browser for editing the logo of the Plone instance.
The Cloud9 IDE gives you code completion in the Ace editor, which makes it easier to edit Javascript (like nodeJS) and in a few months Python should be better.
The code is on github so go ahead and fork it.
See http://c9.io/
We use Concorde for the peer to peer messages. Unfortunately closed source.
Could it be used for online sprints, working on some github code of Plone together, assisting someone on the other side of the world? Yes. For open source it is free to use, for closed source you have one free project, and there are paid plans.
There are a couple of issues with the keyboard in the browser, so if you want to use some editor on the command line. You can override some keys in your browser.