Thursday, March 15, 2007

Apollo Browser in five lines of code

In yesterday's post about what Apollo is, a comment appeared to challenge the notion of being able to implement a simple browser in 5 lines of code. Rather than rebuke it on the comments list, I decided to make this post and place the code here to show how easy it is. This is as simple as it gets, no back buttons, SSL, bookmarks etc, but it is a browser that you can type a URL into and it will navigate to the URL and display the HTML properly formatted.

The sample Apollo MXML code:

<?xml version="1.0" encoding="utf-8"?>

<!--line one. I am not goign to count the XML PI-->
<mx:ApolloApplication mx="" layout="vertical" cornerRadius="12">

<!-- line two -->
<mx:Text text="Enter URL and hit enter" fontFamily="Arial" fontSize="16" fontWeight="bold" />

<!-- line three-->
<mx:TextInput id="urlTxt" width="100%" enter="html.location=urlTxt.text;" text="" />

<!--line four -->
<mx:HTML id="html" width="100%" height="100%" location="">

<!--line five. Not really a line of code, just closing the root tag -->


Here is the screenshot of the Apollo browser application:

Wednesday, March 14, 2007

What is Apollo (Really)? Will it replace browsers?

The evangelist team at Adobe has been busy publicly discussing Apollo, the new flash and MXML based programming platform. During the time we have evangelized, there have been some mis-perceptions. Other than recognizing being an evangelist is sometimes more subtle than not, I want to discuss a few of the issues in this blog over the coming months.

For those who don’t know, Apollo is an internal code name for a stand alone application development platform that uses Flash and HTML to build interfaces. Unlike Flex Applications, Apollo applications exist as stand alone apps and are not bound to the browser. The Flash runtime is part of a native cross platform runtime environment that allows the application access to several core libraries and virtual machines. Apollo applications are cross platform and can utilize local resources to a greater degree than Flex based applications, yet less than full blown stand alone applications written in conventional languages that are targeted for single operating systems.

At a recent event, after a lengthy discussion and demonstration of Apollo’s functionality, a question came from the audience.

“Why do you want to replace the browser?”
The shocked silence that ensued made me personally realize that we have not clearly communicated the value proposition of Apollo. It is simply not true that we want Apollo want to replace the browser (even though you can build a simple browser in as few as 5 lines of code). The proposition of Apollo goes far beyond that capability. So what is Apollo? In Mike Chambers book he describes it with the following sentences:

“Apollo is a new cross-platform desktop runtime … that allows web developers to use web technologies to build and deploy Rich Internet Applications … to the desktop.”

Apollo is a middle ground, hybrid approach when a browser based application does not quite fulfill the requirements yet building a full blown, stand alone application might be too overkill, slow or complex. It is important to note that Apollo applications do have a very full featured set of libraries to build very complex applications. In no way should anyone consider an Apollo application as a feeble, halfway attempt at application development. Quite the opposite is true. Some of the early applications we have seen on the internal beta mimic the appearance and functionality of Apples’ Photobooth, standalone Text Editors with HTML capabilities, A Universal Business Language (UBL) editor, MP3 music players that can read your local iTunes library file, import it and use the ID3 metadata tags to search and retrieve photos from Flickr tagged with the same terms.

So why is this important? Why would you want to do this? Browsers are general purpose work horses and will not go away anytime soon but there are instances where browsers start to not fit the requirements. Browsers are best suited for online access to data. Sometimes, data needs to be worked with offline and later synchronized with multiple other data models. Browsers were not built to fulfill this task. Like wise, browsers are best suited to natively work with remote resources. The virtual machines for scripting languages cannot interoperate with local resources in a way native applications can without explicit permission being granted. Even then, most virtual machines have severe security limitations (* generally a good thing). Apollo transcends some of the restrictions of browsers.

Like browsers, Apollo also is not out to kill native applications, but can be used to rapidly (I meant very rapidly) prototype or build applications that can do many common tasks. Skinning the applications with Flash also allows a very rich user interface to be built that can transcend the typical opaque rectangular box approach of conventional applications.

Hello World – it’s me, Apollo!

Apollo applications can be built using certain builds of Flex Builder, but it is important to note that you can also use a plain text editor and the free compiler from Adobe labs (when available). To use Flex Builder, you benefit from first going to download and install the Apollo Extensions first (watch this space for the public beta announcement). You simply declare the root element as . The following code is an Apollo application that uses HTML code. The formatting is bad to fit the code into the columns available.

This yields a very simple application that looks like this:

Note that the cache button does not yet do anything. This was written as a prototype based on a request from Redmonk's James Governor. It is risky putting this up as it may trigger his memory and he'll leave a comment asking me to complete it soon. Duck!

Here is another example of an Apollo Application that traces a slider value and binds the data value to another component. It also changes the test on the label from “Hello Nobody” to “Hello World” when the slider value changes to be above “3”.

The Apollo Application looks like this:

Suffice to say, Apollo fills an important niche (pronounced “neesh”, not “nitch”. The latter really bugs me and most other Canadians). It’s going to be out there for you to play with soon so please take a look at it and see what you can do.

And all together, let’s say it one more time:

“Apollo is not out to kill Browsers”