NgeBlog

What’s the Future of OpenLaszlo?

September 15, 2008 · 2 Comments

What is OpenLaszlo
OpenLaszlo is an open source platform for developing user friendly web based applications, which work identically across all popular browsers and platforms (Windows, Mac, Linux, IE, Firefox, Safari, etc). It’s ideal for presenting and editing raw XML data generated by JSP, PHP and other web services.

OpenLaszlo supports a rich graphics model with scalable vectors, bitmaps, movies, animation, transparency, fonts, audio, streaming media, reusable components, user interface widgets, control panels, property sheets, keyboard navigation, browser “back button” navigation, as well as advanced WYSIWYG text and graphical editing tools. In other words, OpenLaszlo is the velvet glove for the iron fist of PHP.

OpenLaszlo is designed to use open standards, and built with open source tools and technologies. It’s a high level architecture designed to target multiple rendering environments, and the first one it currently supports is Flash.

OpenLaszlo’s platform independent architecture gives it the ability to target other runtime environments like DHTML, Java, XUL, Avalon, SVG, open source Flash players, cell phones and other embedded devices, as they become more powerful and mature. The Platform Roadmap describes the development goals and progress towards the next major release, which will include support for multiple runtimes, and many architectural improvements.

Why Flash Now?
The Flash player itself is not open source, but it’s freely available, often pre-installed, and widely deployed on 97% of user desktops. Its advantage over DHTML is that it’s perfectly consistent across all platforms, and seamlessly supports many advanced multimedia features.

How Does OpenLaszlo Relate to Flash?
While OpenLaszlo takes advantage of Flash, it also gives you independence from it. Because of its architecture, it’s not tied to Flash the way Macromedia Flex is. It will support future versions of Flash, as well as other platforms as they become more widespread. The Flash authoring tool may be used to develop content for OpenLaszlo applications, but it is not required.

What are Flash’s Limitations?
Flash does not have a JavaScript source code compiler or interpreter built into the player. The Laszlo compiler and Flash authoring tool both translate JavaScript source code into byte code instructions (like Java), and combine them with multimedia resources into a binary SWF files, that the Flash player can execute.

The Flash player can only read a limited set of multimedia data types, with certain restrictions. Other data types must be transcoded or pre-converted into formats directly supported by Flash, like SWF and JPEG files. The new Flash player version 8 supports other formats like GIF, PNG and progressive JPEG, but it’s wise to support older versions of the Flash player, when possible.

It has an XML parser, but it doesn’t have native support for other XML standards like XPath or XSLT, like many web browsers. The OpenLaszlo runtime supports XPath, and provides data binding as an alternative to XSLT.

Security restrictions prevent the Flash player from fetching XML from hosts other than the one it downloaded the SWF file from. It requires a crossdomain.xml permission file to exist on other servers from which Flash downloads content or calls web services. This can be a problem for implementing interfaces to web services that you don’t have control over, that don’t support crossdomain.xml.

The solution is for the OpenLaszlo Server or PHP to act as a proxy for other servers. An intelligent proxy can go further by transforming the data or mashing it up with other web services, databases or utilities, to provide unique and exciting new web services.

Understanding Important OpenLaszlo Concepts
OpenLaszlo application source code is written in the “LZX” language, which is XML with embedded JavaScript code. Laszlo programs can also include reusable component libraries and resources in various formats such as audio, images, SWF vector graphics, animations, movies, fonts, rich text and XML data. The OpenLaszlo Server provides a compiler that translates text LZX programs, libraries and binary resources into binary SWF files that the Flash player can execute directly.

OpenLaszlo Server Features
The OpenLaszlo server has many features: dynamically compile, debug and optimize OpenLaszlo programs; act as a proxy for OpenLaszlo applications, so the Flash player can communicate with other servers; perform XML-RPC and SOAP calls; send and receive messages over persistent connections with other clients; transform XML into an efficient binary representation; transcode various file formats into SWF files that the Flash player can digest directly.

“SOLO” Mode
Networked OpenLaszlo applications can take advantage of the OpenLaszlo Server by running in “proxied mode”. And you can also develop applications that run independently in “SOLO Mode” (Standalone OpenLaszlo Output). SOLO applications talk directly to your PHP server, or other XML web services like Flikr, Google Maps, etc. Self-contained OpenLaszlo programs can run without any network server at all. They can even be deployed as desktop applications.

XML Data
OpenLaszlo uses XML data for structuring programs, reusable component libraries, class definitions, resources, declaring JavaScript classes, methods and attributes, creating and configuring objects and data bindings. XML datasets can be efficiently precompiled into OpenLaszlo programs, or asynchronously downloaded from web services, and then automatically bound to JavaScript objects.

JavaScript Code
OpenLaszlo uses JavaScript code for defining scripts and method bodies, event handlers, attribute expressions (automatically updated constraints!), as well as representing objects, XML structures and graphical views as JavaScript dictionaries. Laszlo represents and manipulates XML as JavaScript object dictionaries, and has a sophisticated asynchronous XML data binding system that uses two-way constraints to tie the properties of JavaScript objects together with XML data, and drive the creation and replication of intelligent data bound Laszlo views.

Declarative Programming
Declarative programming is an elegant way of writing code that describes what to do, instead of how to do it. OpenLaszlo supports declarative programming in many ways: using XML to declare JavaScript classes, create object instances, configure them with automatic constraints, and bind them to XML datasets. Declarative programming dovetails and synergizes with other important OpenLaszlo techniques including objects, prototypes, events, constraints, data binding and instance first development.

Constraints
Constraints in OpenLaszlo are object attributes whose values are defined as functions of other object or XML data attributes. They’re used to configure the relationships between objects, their attributes, and XML data. Like a spreadsheet, Laszlo conveniently keeps track of all dependencies, and automatically updates constraints when the values they depend on change. Constraints can refer to object attributes with JavaScript expressions, and also XML data with XPath expressions.

Automatic constraints are a wonderful feature, for the same reason that automatic garbage collection is great. They save programmers a huge amount of tedious error-prone effort and repetitive coding, by automatically and reliably performing intricate housekeeping tasks. They also make the code much more readable and concise, by letting you express what to do, instead of how to do it (which is the essence of declarative programming).

XML Data Binding
XML data bindings are XPath based constraints that create two-way connections between object attributes and XML data. When an XML data bound attribute is changed, the XML data and all constraints that depend on it are updated, so it’s easy to implement automatic updating of multiple XML data views and editors.

XML data bindings can also cause the replication of exemplary Laszlo objects (prototypes), so you can declare how one object will look in terms of an XML element, and it will automatically replicate a separate instance for each XML element in the dataset.

Categories: Open Source · Uncategorized

2 responses so far ↓

Leave a Comment