Preface

Table of Contents

1. Audience and rationale for this book
2. On Runtimes and Deployment Modes and the "Core" API
2.1. Learn by Doing
2.2. Sequential and Random Access
3. Typographic Conventions
4. Related documentation
5. Suggested reading paths
5.1. Use the Forums

We invented this technology to make it possible to create web applications that are delightful to use.

Every computer user knows the power of the Internet, and every web surfer has been awed at one time or another by the vast wealth of the Web. But at the same time everyone knows, even if they only know it subconsciously, that web-based applications running in a browser offer a user experience that is inherently inferior to that of locally-running programs. There is something almost retrograde about interacting with websites; they're anomalous, like rotary telephones in a touch-tone world.

The reason for this is clear. It's not because web designers don't know anything about usability or visual design or software engineering. It's because they have not had the tools they require to build the web experience they conceive.

HTML is a great thing; DHTML is a great thing. Adobe's Flash™ is a great thing. But none of them allow developers to create astounding user experiences, because all of them are based on fundamentally limited models. The variants of HTML are based on the metaphor of a "page," which forces users to process information in arbitrary discrete chunks separated by jarring transitions and "page refreshes." Flash offers the possibility of a much more continuous user experience, but its "movie" metaphor forces developers to leave behind many essential tools and techniques of modern software development.

In contrast, the OpenLaszlo solution was built from the ground up for application development — not "page" development, not "movie" development — and is centered around standard development approaches. LZX applications are written in XML files with embedded JavaScript, which provide an ideal foundation for serious developers. OpenLaszlo supports standards-based object-oriented development and data binding, and enables rich interactivity without requiring complex, timeline-based visual authoring.

The result is applications that are delightful to use. Now, delightfulness is in the eye of the beholder, of course, and that's why we suggest that you right now click on our e-commerce application. This program communicates with Amazon.com's data servers and allows you to browse their products, create a wish list, fill a shopping cart, and so forth. So in many ways it's just like any other similar e-commerce site. But notice that there are no screen refreshes, and that you can move items by dragging them with the mouse, that it's hard to get "lost." Now consider that this program was written in a few hours using a simple text editor.

We suggest that you play around with any of the dozens of other sample applications here or on the Laszlo Systems website to get a feel for what a Laszlo application is like. One sometimes hears the phrase "Rich Internet Application" to describe programs like these, and their defining characteristic is that they make people smile. A growing body of empirical studies shows that when people have a more pleasant experience on a website, the longer they stay there, and on commercial sites, the more commerce they transact.

1. Audience and rationale for this book

This book is written for software developers who have familiarity with the concepts of object-oriented programming as implemented in languages such as Java, C++, or JavaScript, and with the fundamentals of XML data formats.

We also hope that this guide will be accessible to web developers who know HTML and CSS but haven't yet worked with object oriented languages, and to developers and designers familiar with Flash or FlashMX. If this describes you, you may have a little homework to do outside the scope of this book, but in general you should have no trouble becoming a fluent LZX developer. A good place for you to start learning would be with the tutorials.

2. On Runtimes and Deployment Modes and the "Core" API

OpenLaszlo applications can be compiled to run in any of several runtimes, and in either of two deployment modes. Some capabilities are available in only a subset of these use cases. OpenLaszlo's "core" APIs run on all target runtimes, and they get the most attention in this Guide. The "Core API" is kind of loose concept, since there's no formal definition, but what it means is that unless you see indication to the contrary, you can assume that the topic under discussion applies to all runtimes. Similarly the default deployment mode is assumed to be SOLO.

Nevertheless, as a developer you have to decide whether to:

  1. optimize for swf (employ swf-only APIs, (and maybe even touch Flash APIs))

  2. optimize for dhtml (employ dhtml-only APIs)

  3. code to lowest common denominator ("core" APIs only)

  4. conditionalize (include both. An example would be including comma separated list of embedded and system fonts; when compiled to swf you get embedded font, to dhtml you get system font).

The focus of the Developer's Guide is (c), the lowest common denominator; runtime-specific APIs and engineering approaches are presented as adjuncts. Graphic devices ("glyphs") in the margin call attention to non core/non SOLO information.

Depending on which approach you're taking, you'll make different engineering decisions and different approaches to reading the this Guide. For example, if you're determined to deploy SOLO, you can just skip all the chapters marked with the "Server Required" device, etc.

Finally, this Guide does not address any browser-specific considerations. If a thing does not run on all supported browsers for a given runtime, it's by definition not supported and thus should not be cluttering up our lovely Guide. Nonstandard, browser-specific things are described in the release notes or the OpenLaszo Wiki.

2.1. Learn by Doing

This Guide contains hundreds of "live" examples, that is, Laszlo Applications that are embedded in this page. You'll have more fun and get more out of this document if you "play with the code." To do so, simply click on the "Edit" link at the bottom left corner of each example. This will cause a new window to pop up that is a self-contained environment for modifying and executing Laszlo applications. Edit the sample code then click "update" and see the results displayed in the right-hand side of the window. To return the sample code to its initial state, click "Reset."

If you would like to save a copy of the application for later use, click on the "Save As" button.

2.2. Sequential and Random Access

Designing, Developing and Deploying Laszlo Applications is intended for sequential and random access. In general, each chapter draws on the concepts covered in the chapters that precede it, but not (too much) on those in the chapters that follow it. If you start with Chapter One and read to the end, you won't get lost.

At the same time, each chapter is designed to be encyclopedic: the chapter on Animation covers the entire subject of animation, and so forth.

Short, self-contained examples appear throughout. Links are provided to longer examples.

3. Typographic Conventions

Code is displayed thus: var a = f(2). Longer sections of code and other verbatim information is displayed in a separate paragraph:

An example file
that spans several
lines

Example programs are shown thus:

<canvas height="20">
  <text>Hello World!</text>
</canvas>

Some example programs are run within the page. The running application is shown first, followed by the application source code, followed by an Edit button that allows you to try out the effect of making changes to the application source code.

<canvas height="20">
  <text>Hello World!</text>
</canvas>

4. Related documentation

In addition to this Developer's Guide, please see also

5. Suggested reading paths

The best way to use the LZX Developer's Guide depends on your experience.

Experienced Object-Oriented programmers: We suggest that you start by reading Chapters 1, 2 and 4 of this Guide. If you have never worked with JavaScript, you can learn the basics quickly at one of the JavaScript tutorials at W3Schools, WVDL, or PageResource.com. Then visit the OpenLaszlo website and play around with the tutorials and sample programs; as you read the sample code be sure to look up appropriate entries in the Reference Manual. At that point you'll know what further reading you need to do in this guide.

Web/Flash developers with no Object-Oriented experience: We suggest that you start with the tutorials in order to get a general feel for LZX programming. Don't worry about mastering the subjects they cover; your goal is to begin to get comfortable with the language.

If you need to, learn the basics of XML.

Then read the rest of Part II, “Overview”.

5.1. Use the Forums

The best way to learn any programming language is to draw upon the experience and goodwill of its development community (and to write code! as the saying goes, nobody learned to ride a bicycle by reading about it). The LZX developer community has a home at http://www.laszlosystems.com/developers/community/forums/. There you will find an active discussion of all aspects of the language, and a place to ask questions of your own.