GitHub has announced its new code editor. It is called Atom and is a shocking comment on the state of web apps and web development in general. It has even had to coin a new term "web native".
While most reports are highlighting the fact that GitHub has a new code editor designed to be easy to use for both beginners and experts, the real news is how the editor has been created.
When you think of GitHub's approach to hosting code in the "cloud", there is no doubt that any editor to be used as part of its services has to be a cloud hosted editor and presumably a web app of some sort. There are plenty of examples of in-browser editors - Orion from Eclipse, for example, not to mention the editors included with live coding sites such as CodePen.
The big problem that GitHub had was the simple fact that browser based web apps are so tightly controlled from a security point of view that simple things like accessing the file system isn't allowed.
As the Atom blog puts it:
"...More importantly, the browser severely restricts access to the local system for security reasons, and for us, a text editor that couldn't write files or run local subprocesses was a non-starter."
So what to do?
The solution is a surprising one. They took the source code of Chromium, the open source browser that Chrome is based on and customized it to work with the Atom web app. Put simply they have removed all of the security features built into the browser and this allows Atom to access anything it needs to.
From the users point of view this is a very strange situation because they are running a web app but they have to down load a special desktop app to run it!
The advantage of this approach is that the web app part of the system can be continuously updated and it has all of the interactive qualities of a web app but without the security restrictions. As the Atom blog points out it also solves the problem of browser compatibility:
"Another great thing about writing code for Atom is the guarantee that it's running on the newest version of Chromium. That means we can ignore issues like browser compatibility and polyfills. We can use all the web's shiny features of tomorrow, today."
The disadvantage is that the user has to download a special desktop app and can't just move to another machine to work without downloading and installing the app. At the moment the desktop component only runs on OS X and while Windows and Linux version should be coming soon this proves the point that having a desktop component is a problem.
The security implications are small because the desktop app will only download and run the Atom web app and you can't use it to browse any old website you care to. That is, the URL etc of the Atom web app is hard coded into the desktop app. Of course, it is always possible someone will figure out a way to change it and open up a security breach.
"Node.js support makes it trivial to access the file system, spawn subprocesses, and even start servers directly from within your editor. Need a library? Choose from over 50 thousand in Node's package repository. Need to call into C or C++? That's possible, too."
However, it is also "full-featured" without customization, comprising:
- File system browser
- Fuzzy finder for quickly opening files
- Fast project-wide search and replace
- Multiple cursors and selections
- Multiple panes
- Code folding
- A clean preferences UI
- Import TextMate grammars and themes
At the moment access to the editor is by invitation to a private beta - you can request an invite at the Atom site. Many of the libraries and packages have been open sourced but at the moment it looks as if the desktop app will remain closed source.
Is this "Web Native" approach a good idea?
A custom browser offering access to all of the facilities of the host machine simplifies things in a big way and it makes web apps the equal of any desktop app - something that still isn't true despite all of the efforts of Mozilla and Google in pushing HTML APIs forward.
The cost is that you have to use a custom wrapper for the web app.
Does this sound familiar?
It's precisely what Cordova, aka PhoneGap, does to get web apps running as native apps on a wide range of devices.
Why not do it for the desktop?
Perhaps PhoneGap should spin off DesktopGap.