Exploring Adobe AIR

// September 23rd, 2009 // No Comments » // Actionscript, Computer Software, Flex, Web Development // Actionscript, Computer Software, Flex, Web Development

Recently, I’ve begun developing a Flex application for the desktop using Adobe’s Integrated Runtime (AIR), which is a local library for running Flex applications. One of the most enticing features of AIR applications is the ability to deploy them cross platform with little to no machine-specific code (except perhaps special keystrokes on Mac).  As well, the ability to store data on the client machine is also extremely convenient.  Gone is the worry of keeping a web interface tuned to the application, which can assist in streamlining development into a more user-friendly product.

The only downside to the desktop application is the lack of custom data that would have previously been delivered through the web interface. At least, that’s what I thought.

My exploration into the AIR libraries and many tutorials on the web is that AIR has built-in, for free, SQLite that will allow an application to store and manage data persistently for the lifetime of the application’s existence on the client machine.  There are some minor limitations from a backend development standpoint (like lack of stored procedures), but nothing that should be a surprise to users familiar with ‘lite’ databases.

One of the difficulties with local storage like this is the fact that sensitive data stored through SQLite is not necessarily secure, since it exists on the user’s machine unencrypted. If this were a regular Flex application, all of the data would reside on a database server we own. However, since this on the client’s side, Adobe has a featured called encrypted local store.  The usage and explanation of this feature is out of the scope of this article, but it’s simply a class with static methods that can “get” and “set” values of any kind into encrypted storage. Perfect for storing authentication tokens, and other similar pieces of data.

With data taken care of entirely through AIR, it leaves the developer available to focus to on the user experience with their application. Which for me, has always been a very difficult part to nail down. I’ve written about GUI design previously, and still learn new things everyday either from coworkers, or my own personal experience with software I use frequently.

Hopefully by year end, Flash Builder 4 (the successor to Flex Builder 3) will be released, but more importantly, a program called Flash Catalyst will also be released (likely in tandem). Judging by the demo videos of designer and developer working together to build a Flex interface, mocking up a realistic interface can include physically converting the items in the mockup into flash style definitions.

The more I watch the demonstrations of this technology, the more tempted I am to put my pet project on hold and wait for these to be released.  The trial download for Flash Builder 4 is available from Adobe Labs, though I challenge anyone to use it for the full 30 days and try to return to the previous version. Luckily, my last install of the trial was interrupted by a failed hard drive – I was subsequently saved from the spoils.

Future posts will explain my experiences with my pet project in AIR, which I hope to release to public use as soon as it’s near stable, likely sometime in the new year.

Chrome Competes Against IE, Not Firefox

// September 4th, 2008 // No Comments » // Computer Software, Google, Microsoft // Computer Software, Google, Microsoft

The release of Google’s Chrome browser sent the blogging world mad, including myself.  And after its release on Tuesday there were at least 3000 new articles and blog posts reviewing and analysing it. Most writers have equally been surprised at the bold movie by Google, who has long supported Firefox and their growing market share of web browsing.

Some of the initial questions after its release were, are they competing with Firefox? Does this end the partnership?

The answer simply, is no, and even though the Mozilla Foundation was surprised by the release (even though they won’t admit it), they don’t feel that Chrome is meant to be an attack against Firefox or a sign of impending doom for the partnership between Google and Mozilla.

Mozilla Europe president, Tristan Nitot, commented in a PC Pro article:

I think Chrome is not aimed at competing with Firefox. Rather it’s made for competing with Internet Explorer.

And the featureset that Chrome has been released with seems to backup this statement. With Internet Explorer 8’s Beta 2 release on August 27th, Microsoft has been hard at work perfect a multi-threaded browser to allow each individual tab run separately away from the main bulk of the application.

Tristan goes on,

We don’t have a strategy which is competing with Google. We’re not offering a search service, we’re not selling advertising, while Microsoft has made a lot of noise that it wanted to go there.

It makes sense that as the web presence of Google grows, so does Microsoft’s desire to chase the revenue that Google is trailblazing.  Mozilla’s always remained a simple, neutral entity directed at improving a user’s web experience, regardless of any other corporate giants vying for their attention.

What’s been made clear is Google is about web applications, and Chrome was designed to improve that relationship with the user, and both Internet Explorer and Firefox have yet to venture into a deeper, more focused browsing experience in that sense.

It’s important to remember that Google knows the Internet. And Chrome is their gateway to building the future the way they see it. And Microsoft will stop at nothing to end the trend-setting whirlwind that they (ironically) invented with the release of Windows 95.

Google has made it clear that they don’t feel the state of browsers on the market is acceptable. Also quoted in a PC Pro article, Eric Tholome, product managing director of applications at Google says:

The pace of development of apps on the internet has outpaced browser development. There’s a lot of frustration out there that we could solve. The only way we could do that is from a fresh start.

And with Google Documents competing directly against Microsoft Office and providing those services as an online resource only, it made sense that in order to further their share of the business they provide they needed a way to better present that and to make it more useful.

So does this mean that the heat’s off Firefox? Not entirely, there are some features of Chrome that will need to be standard on browser (private browsing, threaded tabs) and Firefox will catch up to those, but it’s impossible to release a product like this and expect the other siblings on the market to rub shoulders and play fair. The future of the Mozilla/Google partnership might be friendly, but surely won’t be quiet.

The war against Microsoft however, just got a lot louder. And if anyone in Silicon Valley is reading this, it might be time to hide the chairs again.

* And for anyone still concerned about the Chrome TOS that were blatantly ripped from their other services, it’s been updated:

11. Content license from you
11.1 You retain copyright and any other rights you already hold in Content which you submit, post or display on or through, the Services.

Component Crazy: Handling Your Growing Flex Application

// September 3rd, 2008 // No Comments » // Actionscript, Flex, Web Development // Actionscript, Flex, Web Development

It’s no surprise to developers that the requirements for an application are bound to change, and it’s because of this fact that there are numerous architectures for developing software applications that can ease the process of adding new functionality. 

For Flex specifically, one such architecture is Cairngorm, which has been described here a few times. But as easy as it is to manage important events in the application, even the best architecture fails to simplify a project.  It always gets to a point where there are too many pages to keep track of.

Using a personal example, the backend administration tool that has been in development for my entire tenure at the company (and as such, requirements have shifted dramatically over this time period) has grown to house a fairly large number of major components. Two types of search pages, two types of master-detail pages, a login page, two types of general site maintenance pages and a number of custom renderers and other compents necessary for image retrieval and display.

How does one keep track of all these different areas that a user is supposed to seamlessly surf through?  At first I had a show/hide game going on, but after about 3 different major compents were in use, the process became unmanageable. 

Then I discovered States.

Using the ModelLocator of the Cairngorm architecture, I decided to hold two significant states: the authentication state, and the application state. Both variables declared as strings.

Here’s how the format of the application implements states:

MainApplication.mxml -> Two states: Valid, or invalid.  

When this loads, it dispatches a Cairngorm event to check if a user session exists (via amfphp, to a Zend_Auth controller), if does then the variable for authentication state in ModelLocator is set to “valid”, if not it is set to “invalid”.

In the MainApplication.mxml file, two states are listed such:

1
2
3
4
5
6
7
8
9
10
11
12
<mx:states>
	<mx:State name="invalid">
		<mx:AddChild>
			<mx:LoginComponent />
		</mx:AddChild>
	</mx:State>
	<mx:State name="valid">
		<mx:AddChild>
			<mx:WrapperComponent />
		</mx:AddChild>
	</mx:State>
</mx:states>

The currentState property of the application is bound to the ModelLocator variable for authentication state. So in the event that this property changes to either of these states, the child component will be loaded.

In the case of the administration tool, one of these is a login form and the other is a wrapper component for the next tier of major components. For this example it is called WrapperComponent. Its currentState property is bound to a separate ModelLocator variable to control the general application state.

This solved the problem of having to manage N different components in a complex administration system, and now the code will only need to manage the application state variable and the rest is taken care of.

For added flair, states can also have transitions set to them. Which if done correctly and sparingly, can really add to the look and feel of an application.

Google Chrome: Hands-On First Impressions

// September 3rd, 2008 // 1 Comment » // Computer Software, Google, Microsoft // Computer Software, Google, Microsoft

The Comic Knows All

Google Chrome first came to my attention on Monday via a Blogoscoped post linking to a comic strip that detailed the features of an upcoming web browser from Google. The comic strip, meant to be the initial ground-breaker to the public about the web browser, was created by none other than Google.

I checked the date several times to be sure it wasn’t April 1st, and even then I wasn’t fully convinced what I was reading was reality.

Nevertheless, the internet world was abuzz for a full 24 hours before Google announced a live conference to present and explain everything about the browser. I was also able to learn a few things about the browser before it was launched so I had a fairly good idea of what I was getting into.

The Skinny

Chrome uses the Webkit rendering engine that Safari and Konquerer use. One of the gentlemen during the live presentation stated that one of the reasons for using an existing rendering engine was to avoid unnecessary headaches for web developers in trying to account for a new set of rules (and it’s much appreciated, having to write for Webkit, Gecko, and IE is bad enough as it is).

Another feature to Chrome is Google Gears, which is intended to act as an advanced caching utility that will allow offline browsing of content you’ve already viewed. Essentially, it’s a super light database that Chrome manages for your viewing convenience, and the performance of Chrome greatly enhanced by this addition.

Chrome also has threaded tabs, which means that each tab is an independent browsing application of its own, and Chrome even features an in-application task manager (right click on title bar) that will allow users to manage and kill any of the running processes.  What’s important to note is that any plugins running on webpages, like YouTube’s flash module to match the example from the live presentation, can be killed independently from the window in the event the plugin fails.  What replaces the flash objects are a frowny face in a puzzle piece, and a refresh of the page will return the world to normal. It’s important to note that even if a plugin is killed, the rest of the page objects that were not apart of that process are all in working order, easily browseable.

The Fancy

Google Chrome was made for the minimalist, but it was also made for those of us who like a few sprinkles on our vanilla ice cream.

Tabs slide in creation and destruction, can be pulled away from the main frame with a fancy transparent overlay, and released as a new application window. The download process will flash an arrow to the bottom bar, show the progress and flash when finished. All downloads by default live in the My Documents/Downloads directory.

As well, clicking on the page icon and choosing “Create application shortcuts…” will allow whatever site you are on to be linked as a shortcut on your system, and when launched, will act as a new application window that appears to reside outside of a browsing format. Useful especially if your primary email happens to be webmail, and need the quick access.

The Fat

Most power users will immediately notice the lack of in-depth options. Which is to be expected, as Chrome is very much a beta product, but nevertheless there are certain things an experienced user would prefer to have control over. For instance, third party cookies can only be restricted in their use but not blocked entirely.

Another feature that is not surprisingly missing is the ability to block advertisements. Having used Adblock for what feels like a blissful eternity, seeing all of my favorite sites smattered in annoying and error-laden objects is a little disconcerting.  Third party themes and plugins should definitely high on the priority list in getting Chrome some lasting exposure.

The Verdict

Google Chrome is a very nice product in which a lot of careful thought was put into. Clearly, a new browser is on the block, but it may not be entirely for competition’s sake as it intends to be more focused making web applications a more important experience rather than just flipping through web pages. Nevertheless, a significant amount of pressure now weighs on the shoulders of both Mozilla and Microsoft to match Google’s out-of-the-box thinking on the web experience.

Currently, Google Chrome is only available for Windows, but on the horizon are forthcoming versions for both Mac and Linux operating systems.

Hello Data Modeling, My Old Friend

// August 5th, 2008 // No Comments » // MySQL // MySQL

About 2 weeks ago I was given the opportunity to step away from Flash and Flex and get back to the basics of application development: designing a database.

For those that don’t know me, I’ve spent my entire software development career before May of this year developing custom software solutions for a wide variety of clients. Being in a small team, this rendered me the opportunities to develop through nearly all aspects of the SDLC including designing a data model.

Previously most of my experience had been using Microsoft’s SQL Server, but now this time I’d been handed the challenge of an open source solution in MySQL. A few versions ago this might have caused me some minor heart palpitations, but luckily with recent versions of the product, there are a lot of creature comforts that I can work with thanks to the InnoDB storage engine.

Stored Procedures

This topic is easily debatable, and it especially depends on the architecture and scope of the application, but I am a very large supporter of stored procedures in RDBMS. The reason for this is a few things:

  1. They are compiled on the database server – meaning, an SQL string will not need to be passed every single time from the web application to the database server. This can increase performance by reducing the network load.
  2. Easy to debug – running a stored procedure from MySQL Query Browser (or whatever your flavor is) is far easier than stepping through a PHP debugger or dumping variable values, and this can in turn make the problem solving step far simpler.
  3. Separates web code from DB code – this is extremely important to me, and being able to leave the in-line SQL strings behind can greatly clean up and simplify an application.

Foreign Keys

It actually surprised me to uncover that foreign keys are relatively new to MySQL, and on top of that, the application that I’m in the middle of rebuilding the database for was built without any relationships between the tables at all.  There is a good possibility I’ve been spoiled by a paid product, but I had assumed data integrity was far more important than leaving out such a vital component for so long.

With these features at my disposal I felt a little more comfortable diving into MySQL Workbench and creating a working database model.  It’s one thing to build a model and improve upon an old product, but without the ability to form relationships between the tables and manage its data directly with stored procedures, it can be nightmarish.

My next task is to ensure the data migration (via stored procedure, I’ll plainly brag) has fit into the new site’s requirements and have retained all the necessary and previously assumed relationships between the entities of data.

To say this is a boring or stressful task would be doing the process a great disservice, but after spending so long developing RIAs with Flex, going back to the basics with some raw SQL and modeling an ERD, it has been a welcome change and has completely envigorated me professionally.

Here’s hoping I continue with more of the same.