Sun Labs Lively Kernel
and
Lively Kernel for Qt
Tommi Mikkonen, Antero Taivalsaari
Dan Ingalls, Krzysztof Palacz
Sun Microsystems Laboratories
firstname.lastname@sun.com
About Us: Tommi Mikkonen
• Tommi Mikkonen is a Professor of Computer
Science at the Tampere University of Technology.
• Tommi is a well-known expert in the area of mobile
software; arranged the first university courses on
mobile software development in Finland.
• Spent a two-year sabbatical at Sun Labs in
September 2006 – September 2008, working
on the Sun Labs Lively Kernel.
• In the Lively Kernel project, Tommi's focus is on
the mobile versions of the Lively Kernel.
• Tommi leads the web programming research team
here at the Tampere University of Technology. 2
About Us: Antero Taivalsaari
• Antero Taivalsaari is the original designer of the
Java ME platform at Sun.
• Started the project at Sun Labs in Mountain View,
California, in January 1998; wrote the original KVM.
• The first Java ME Engineering Manager at Java
Software in Cupertino, California in 1999-2002.
• Moved back to Finland in the end of 2002;
continued the work on Java virtual machines and
Java ME standardization remotely.
• In August 2006, re-joined Sun Labs and co-started
the Lively Kernel Project with Dan Ingalls.
3
About Us: Dan and Krzysztof
• Dan Ingalls was the co-designer of the Smalltalk
programming language and environment at XEROX
Palo Alto Research Center, working with Alan Kay.
> Father of five generations of Smalltalk systems.
> Keenly interested in web programming these days.
• Krzysztof Palacz is a researcher and software
engineer in the Lively Kernel Project.
> Ph.D. from Purdue University
> Strong background in web technologies.
> Played a critical role in the design of the current,
SVG-based version of the Lively Kernel.
4
Project
Background
5
Evolution of the Web
1) Simple pages with text and static images only
(e.g., http://www.google.com)
2) Animated pages with plug-ins
(e.g., http://www.cadillac.com)
3) Rich Internet Applications
(e.g., docs.google.com)
What's
Next?
6
Web Applications – Implications
• Web-based software will dramatically change the way
people develop, deploy and use software.
• No more installations!
> Applications will simply run off the Web.
• No more upgrades!
> Always run the latest application version.
• Instant worldwide deployment!
> No middlemen or distributors needed.
• No CPU dependencies, OS dependencies, ...
> The Web is the Platform.
7
Unfortunately...
• The web browser was not designed for running
real applications.
> It was designed in the early 1990s for viewing
documents, forms and other page-structured
artifacts – not applications.
> Programming capabilities on the web were an
afterthought, not something inherent in the
design of the browser.
• Various Rich Internet Application (RIA) technologies
have been introduced recently to retrofit application
execution capabilities into the web browser.
8
Web Development vs. Conventional Software
The Impedance Mismatch
Web Development Conventional SW Development
- Documents - Applications
- Page / form oriented interaction - Direct manipulation
- Managed graphics, static layout - Directly drawn, dynamic graphics
- Instant worldwide deployment - Conventional deployment
- Source code and text favored - Binary representations favored
- Development based mostly on - Development based on
conventions and “folklore” established engineering principles
- Informal development practices - More formal development
- Target environment not - Target environment specifically
designed for applications intended for applications
- Tool-driven development - A wide variety of development
approach approaches available
9
Landscape of RIA Technologies
Browser-based Plugin-based Custom runtime
- Ajax - Flash & Flex - Java, Java FX
- Google Web Toolkit - (Java FX, AIR) - Adobe AIR
- Sun Labs Lively Kernel - (Microsoft Silverlight) - Silverlight
“thin web clients” ... “fat web clients”
- Run in a standard browser - Browser plug-in - Custom execution
- No plug-ins needed required engine required
- Platform-independent - Custom UI - Runs outside
the browser
- Browser-based UI
- Custom/native UI
Technologies in the web browser serve as the lowest common denominator!
10
The
Sun Labs
Lively Kernel
Project
Rethinking Web
Programming
11
The New Era!
• The Web is the Application Platform
• The Web Browser is the Operating
System (for end user applications, anyway)
• JavaScript is the de facto Programming
Language of the Web
12
Sun Labs Lively Kernel
• The Lively Kernel is a web application development
environment written entirely in JavaScript.
• Runs in a regular web browser with no installation
or plug-in components whatsoever.
• Supports real applications on the Web, with rich
user interface features and direct manipulation
capabilities.
• Enables application development and deployment
without installation or upgrades.
• Allows application development within the web
browser.
13
http://research.sun.com/projects/lively
14
The Lively Kernel in a Nutshell
Key components:
● JavaScript programming language
● Asynchronous HTTP networking
● Desktop-style graphics architecture with zooming
● Morphic application framework (running on SVG)
● Built on existing technologies!
(We're just using those technologies “upside down”)
15
How is the Lively Kernel Different?
• No plug-ins! All you need is the browser.
• No installation!
• No binaries!
• Everything written in JavaScript using a
uniform set of APIs.
• Built-in IDE capabilities – applications can be
developed using the Lively Kernel itself using
nothing more than a web browser.
• In general, the system is fully interactive and “lively”
16
Lively Kernel
on Mobile Devices
17
Lively Kernel for Mobile Devices
• Goal: Build a practical JavaScript-based web
application environment for mobile devices.
• The versions built so far:
1) Port of the Lively Kernel for Mozilla Firefox on
Nokia N810 (using SVG graphics – painfully slow...)
2) Native re-implementation of the Lively Kernel
(a.k.a. ScriptBrowser) on Nokia N810 (using
GDK/GTK libraries – quite fast but clunky graphics)
3) Port of the Lively Kernel for Qt 4.5 on Nokia N810
(rather slow; good graphics)
4) Native re-implementation using Qt directly
(work currently underway)
18
Lively Qt – Overview
• Built on top of Qt's Graphics View Framework
(QGraphicsScene).
> Basic Morphic classes (rectangles, ellipses, etc.)
mapped to corresponding QGraphicsItem classes.
• In the first version, event handling was performed in
JavaScript, using the code from Morphic (slow).
• Transformations (rotation, scaling) mapped onto
corresponding QGraphicsItem capabilities.
• Prototype library (www.prototypejs.org) used to
enhance JavaScript capabilities as well as to
provide a cleaner syntax to JavaScript applications.
19
Lively Qt – Most Recent Work
• We are currently building a new, streamlined
version of Lively Qt.
> http://lively.cs.tut.fi/qt/
• Utilizes the capabilities of Qt more directly.
> Lively classes mapped to QGraphicsItems directly.
> Event handling performed mostly by the Graphics
View Framework.
> QWidgets embedded as QGraphicsProxyWidgets.
• Much better interactive performance, especially
re: event handling.
• Other JavaScript performance problems still remain.
20
Experiences with Qt (Script)
• Qt has great graphics performance. However,
there are still bugs and portability issues in the
GraphicsScene architecture.
> C++ multiple inheritance is problematic for JS; spent a
lot of time fighting the underlying type system.
> QGraphicsProxyWidgets have various rendering bugs.
• QtScript is slow – even slower than SpiderMonkey.
> Modern JavaScript virtual machines (V8, SquirrelFish)
are 20+ times faster in raw JS performance.
> Qt should have a modern JavaScript VM in Core Qt
(not just in WebKit/QWebView).
• Qt APIs should be accessible also from QWebView.
21
Vision / Call For Action
22
How to Build the World's Best Mobile Web
Application Platform for the Next Decade
1) Take a rich graphics framework/API (Qt will do fine!)
2) Take JavaScript (the world's most popular dynamic
language) and make the graphics APIs available to it
3) Use a high-performance JavaScript VM, so that
there will be enough power for real applications
4) Add mobile-specific APIs (à la JavaME MSA)
5) Make the platform available both natively (e.g., for
phonetop applications) and inside the web browser
6) For browser-based, network-downloaded applications,
a security model (à la JavaME MIDP) is needed!
(Of course, the web browser should support conventional HTML/CSS/Ajax pages as well) 23
Thank You! Questions?
Antero Taivalsaari
Tommi Mikkonen
Where is the Lively Kernel Headed?
• The Lively Kernel was released to the public
as an Open Source project in October 2007.
• Available under GPL license at:
> http://research.sun.com/projects/lively
• Current directions:
> support for Microsoft Internet Explorer
> support for on-the-fly creation of web sites and mashups
> better end-user programming / IDE capabilities
> running the system on mobile devices
> building more complete applications
25
The Lowest Common Denominator
Technologies Supported by all the Web Browsers
• HTML. Widely established hypertext markup language for
the creation of web pages.
• CSS (Cascading Style Sheets). A stylesheet language that
is used to describe the presentational aspects of a
document. Allows stylistic aspects of a web page to be
defined independently of its content.
• DOM (Document Object Model). Platform-independent way
of representing a collection of objects that constitute a page
in a web browser.
• JavaScript. Predominant scripting language; supported by
all the commercial web browsers.
• XMLHttpRequest. An interface that allows a web application
to download data asynchronously, without blocking the UI.
26
Morphic User Interface Framework
• The Lively Kernel is built around a user interface
framework called Morphic.
• Morphic was originally designed for the Self system,
and was later used also in the Squeak Smalltalk
system.
• Every graphical object in the system is a morph.
• Morphs reside in a world – a visual container of
objects that can be manipulated in various ways.
• Morphic provides very flexible mechanisms for
object scaling, rotation, zooming, etc.
27