Preface

Table of Contents

1. Preface
1.1. Audience and Rationale for this Book
1.2. On Runtimes and Deployment Modes and the "Core" API
1.3. Typographic Conventions
1.4. Related Documentation
1.5. Suggested Reading Paths

1. Preface

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. OpenLaszlo 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 explore the sample applications and demos here to get a feel for what a OpenLaszlo 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.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 Flash MX. 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 OpenLaszlo developer. A good place for you to start learning would be with the tutorials.

1.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. "Core API" is kind of a 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)

  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 OpenLaszlo Application Developer's Guide is (3), the lowest common denominator; runtime-specific APIs and engineering approaches are presented as adjuncts. Graphic devices ("glyphs") 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 Guide. For example, if you're deploying a SOLO-only application, you can just skip all the chapters concerned with Server issues.

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.

1.2.1. Learn by Doing

This Guide contains hundreds of live examples, that is, OpenLaszlo applications that are embedded in the page. You'll have more fun and get more out of this document if you "play with the code." To do so, click on the Flash or HTML5 button 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 OpenLaszlo applications. Edit the sample code then click Update and see the results displayed in the right-hand pane of the window. To return the sample code to its initial state, click Reset.

1.2.2. Sequential and Random Access

This Guide is intended for both 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.

1.3. Typographic Conventions

Code is displayed like this: var a = f(2). Tags, method names, and attributes are displayed like this: <canvas>. 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 like this:

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

Some example programs are live. The running application is shown first, followed by the application source code, followed by buttons that allow you to try out the effect of making changes to the application source code.

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

1.4. Related Documentation

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

  • The OpenLaszlo Reference Guide . This online, hyperlinked, comprehensive reference for OpenLaszlo contains entries for each LZX tag and API. Its format will be familiar to users of JavaDoc(tm) and similar systems.

  • The Tutorial Introduction provides a hands-on instructional overview of the LZX language.

1.5. Suggested Reading Paths

The best way to use the OpenLaszlo Application 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 at the MDN Doc Center. 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 OpenLaszlo 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 Chapter 4, Overview of OpenLaszlo Application Development.

1.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 OpenLaszlo developer community has a home here, where you will find an active discussion of all aspects of the language, and a place to ask questions of your own.