Mozilla Labs recently unveiled Bespin (which appears to be pronounced “Beh-spin” rather than “Bee-spin”). Bespin will provide a fully-functioning code editor that’s integrated directly into your web browser.

Mozilla’s goal is to create a fast, easy-to-use editor that’s not intimidating, and is accessible from anywhere. The system will offer an extensible API to encourage third-party extensions and Ubiqity-like natural language commands for full control over the editor and its interface.

However, Bespin’s most interesting feature is likely to be real-time collaboration. You and your coding colleagues will be able to work on the same files at the same time and see each other’s changes as they happen. That will certainly appeal to all keyboard-sharing programmers using agile development methods.

If you’re using Firefox 3, version 0.1 of Bespin is live and can be tested at bespin.mozilla.com. It’s very much a proof of concept and lacks features found in some of the most basic editors. HTML, CSS and JavaScript files are supported, although I wouldn’t recommend doing any real work just yet.

Online code editors are not a new idea. However, most projects are quite basic and usually implement an enhanced version of an HTML <textarea> with line numbering and colour-coding. Even at this stage, Bespin implements functionality that is more advanced than any of its competitors.

The most interesting aspect about Bespin is the technology behind the editor itself. Mozilla have used a single HTML5 canvas element to implement the text editing, colour-coding, line numbering, highlighting, scrollbars, and the whole interface. Amazingly, it has been achieved with just 62Kb of compressed JavaScript. Using canvas in this way is a novel idea, and I suspect it will influence many other projects.

Bespin is possibly a little ahead of its time. It will be handy for quick web site updates or perhaps live online presentations, but it has a long way to go before developers abandon their favourite desktop-based editor.

Would you trust your code with online code editors such as Bespin? Could it ever offer the speed, features, security, and flexibility of your current IDE? Real-time collaboration is useful, but would you need it every day?