My Photo
Blog powered by TypePad
Member since 11/2005

March 2008

Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          

Sense

  • Google

27 March 2008

MAX 2008 Call for Topics is open

The official Adobe MAX 2008 Call for Speakers and Sessions has been opened - the best and most innovative topics and presentations are being sought for MAX 2008 in North America, Europe, and Japan. The event will take place in San Francisco, Milan and Tokyo. This is a great opportunity to present and discuss the bleeding edge in Adobe RIA, Web and SOA technologies and their application. As such, post a session that you would like to present or attend at Adobe MAX 2008.

Thanks for helping making Adobe MAX 2008 a success.

20 March 2008

Architecting a Flex app

Architecting a Flex App

Web developers who take Flex for a spin may initially be confused by the user interface model. Although a typical, servlet-style, request-response model will work in Flex, There Is A Better Way. Thanks to the "[Binding]" tag in the Actionscript language, you can bind your view to your model data so that changes to the model are automatically reflected in the view. The Cairngorm microarchitecture formalizes this approach, and is a great starting point for developers who want to figure out how to "make it all work together". In this post I'll describe how variable binding, feature-driven development, and Cairngorm all work together for NoteTag.

Here's how a typical, non-trivial Flex app might be architected:

Domain

The classes that make up the domain model. In NoteTag, this includes Notes, Tasks, and Subscriptions. (A Subscription is a collection of related Notes or Tasks.)
Model

A Singleton that holds bindable instances of the domain model. In NoteTag, the ModelLocator Singleton holds the user's list of Subscriptions, the user's Connections, the current Subscription, the current Note, etc.

View

The UI components (generally, though not always, MXML files). The UI components that are state-dependent are bound to instance variables in the ModelLocator. Any changes to data in the ModelLocator will cause the UI to automatically update, provided that that data is marked as "[Bindable]". An example in NoteTag is the NoteListView, which presents the list of Notes in the current Subscription. If the current Subscription or any of its Notes change then the NoteListView will automatically update to reflect the changes.

Controller

Infrastructure for implementing features as event-driven Commands. Examples in NoteTag include GetSubscriptionCommand, GetNoteCommand, etc.

Business

Business logic classes perform operations on Domain objects, often making calls to remote services and returning the results asynchronously. The SubscriptionManager class is the entry point for most of NoteTag's business logic.

Service

The services layer, which holds all classes that are used to make remote service (HTTPService, RemoteService, and WebService) calls. NoteTag uses a set of service factory classes, which decouple the configuration of specific HTTP services from the components that make calls to HTTP services.
Most application features touch on some or all of these components. Here's the workflow for a typical feature:

  • The View broadcasts an event.
  • The singleton Controller receives the event, maps it to its corresponding Command, and executes the Command.
  • The Command delegates to the appropriate Business object to perform the business logic.
  • The Business object performs the business logic, possibly making one or more asynchronous calls to various Services, and returns the result by dispatching a new event to the Command.
  • The Command assigns the result to the singleton Model.
  • Any Views that are bound to the data in the singleton Model are automatically updated.

So how would this work for a specific feature? When the user selects a Note from the list of Notes (at the top of the screen, below), the Note is loaded from the appropriate repository (Blogger or TypePad) and displayed in the editor (at the bottom of the screen, below):

1. Broadcasting the Event

When the user clicks on the first Note in the list, NoteListView dispatches an event, as follows:

// NoteListView.mxml
private function getSelectedEntry(event:ListEvent) : void {
    var selectedEntry:TagBasedEntry =
    TagBasedEntry(currentFeed.entries[event.rowIndex-1]);

    Application.application.dispatchEvent(
    new GetNoteEvent(selectedEntry.metadata,true));
}

2. Responding to the Event

Because NoteTag's Front Controller has registered itself to listen for all Command Events, it will be notified when GetNoteEvent is dispatched:

// NoteTagController.as
public class NoteTagController extends FrontController {
    public function NoteTagController() {
        addCommand(LoginEvent.EVENT_LOGIN, LoginCommand);
        addCommand(GetNoteEvent.EVENT_GET_NOTE, GetNoteCommand);
        addCommand(GetTaskEvent.EVENT_GET_TASK, GetTaskCommand);
        addCommand(PostNoteEvent.EVENT_POST_NOTE, PostNoteCommand);
        // more commands...
    }
}

Cairngorm's FrontController provides the infrastructure for listening for events and responding to them by executing the appropriate command.

3. Executing the Command

To retrieve the Note, NoteTag needs to make a call to the blog server that stores the user's notes. The GetNoteCommand, which implements Cairngorm's Command interface, takes care of this:

// GetNoteCommand.as
internal class GetNoteCommand extends ChainedCommand {
    public override function execute(event:CairngormEvent):void {
       var initialEvent:GetNoteEvent = GetNoteEvent(event);

        var subscriptionManager:SubscriptionManager =
            ModelLocator.getInstance().subscriptionManager;

        setNextEventHandler(subscriptionManager,
                                        handleLoadNote,
                                        LoadNoteEvent.EVENT_LOAD_NOTE,
                                        onSubscriptionFault,
                                        SubscriptionFaultEvent.EVENT_SUBSCRIPTION_FAULT);

        subscriptionManager.loadNote(initialEvent.metadata);
    }

    private function handleLoadNote(event:LoadNoteEvent):void {
        // handle result here...
    }

    // ...
}

(You may have noticed that GetNoteCommand extends ChainedCommand -- this class chains asynchronous calls together using the setNextEventHandler method. In another post, I'll go into greater detail on ChainedCommand, and asynchronous responders in general.)

4. Executing the Business Logic

The SubscriptionManager handles the loading of the Note by executing a series of HTTP service calls to the tag server and the blog server. When the note has been loaded, the SubscriptionManager will dispatch a LoadNoteEvent, which will be handled by GetNoteCommand.handleLoadNote (see the next item).

5. Updating the Model

GetNoteCommand responds to the event by assigning the loaded Note to the appropriate data member on the ModelLocator:

// GetNoteCommand.as
internal class GetNoteCommand extends ChainedCommand {
    // ...

    private function handleLoadNote(event:LoadNoteEvent):void {
        ModelLocator.getInstance().currentNote = event.note;
    }

    // ...
}

6. Updating the View

Any views that are bound to the ModelLocator's currentNote member will automatically update themselves to reflect the new data. NoteView, the component that's responsible for displaying the Note in an editor, is one such view:

// NoteView.mxml
xmlns:view="com.adobe.kiwi.notetag.view.*"
xmlns="*">

note="{model.currentNote}" />

Every other feature -- publishing a Note, fetching a Subscription, updating a Task -- is implemented with the same Event-to-Command-to-Model-to-View approach. Command-specific Events can be dispatched from multiple contexts, without knowing which Views will be affected. Views can bind to Model changes without knowing where the originating Event was dispatched from. Loose coupling leads to cleaner, more maintainable code.

Stating the obvious - "Enterprise 2.0"

The article "The Connected Generation" takes something most of us have known for years and brings it to the attention of the broader audience - business applications need to support instant and text messaging, the tool of choice for teen communications.

However, I see a more subtle message - Web 2.0 and Mashups which include the IM/SMS *paradigm* are the choice for new business applications. We have already seen this with BPM environments such as that from Vitria, Collaboration environments such as Adobe Connect, C2C systems as the eBay Desktop, and virtual/mobile CRMs as SalesForce. The ability to apply IM/SMS workflows to business applications - not speaking specifically to IM/SMS protocols - through feeds (e.g. Twitter, Pownce) - has been proved an essential collaboration capability.

In BPM, the ability to instantly communicate across roles in the development of business processes (Business analyst <-> Technical analyst <-> IT) while working on the same model (filtered through different perspectives) is an order of magnitude more efficient than what many businesses practice (whiteboard <-> visio diagramme <-> excel spreadsheet <-> word document, all in some non-electronic form, and with plenty of room for interpretation at each boundary).

The collaborative BPM environment is essentially a mashup of a 'chat' feed with other RIA components such as an unified modelling environment, policy and resource management, lifecycle management and MDA/EDA information architecture. Providing an unified model structure from which each role can analyse their particular focus in the process yet work with the same underlying artefacts and easily communicate amongst one another is a very powerful concept.

Similarly, we have had some time to digest power collaboration environments such as Adobe Connect, which provide the same IM/SMS workflows to Collaboration and eLearning. The ability to use 'chat' capabilities combined with bots which enable polling and decision taking, along with multiple parties to interact with the same content take the ability to collaborate to the next level. For aglilies, imagine being able to buddy review code as if you were right next to your buddy, without having to be there, since you both can control the shared environment.

I do suspect that it will take more of the "teen" presence in technology to drive this. The current generation of software professionals coming in from the universities will have enough experience with Web 2.0 communications to see their value. Together with technical leadership which is quite on top of Web 2.0, they can prompt the middle tier - the previous generation of engineers who are still fond of "sneakernet" - to take a second look at things. Change can be good. If outsourcing has proved anything, it is that with proper operating mechanisms, remote workforces can function efficiently. If you can rely on engineers working remotely at the other end of the earth, there's no reason you can't rely on engineers working remotely in the same time zone. And with "teen"s bred on network gaming, IM and SMS on a global, we can expect more of Web 2.0 driving a more adaptable and flexible workforce.


12 March 2008

WebManiacs 2008 - Early Bird Ending Soon

Building on the success of last year's FlexManiacs, the new WebManiacs, to be held May 19-23 2008 in Washington, D.C., is 2 events in one - CFManiacs and FlexManiacs,. With more than 50 speakers, 200 sessions, hands-on sessions, and more, WebManiacs is an excellent opportunity to get the latest on ColdFusion, Flex and AIR. Early-bird discounted pricing closes on March 14th, so register now. Meanwhile I'll refrain from any Early Bird humour. :-)

10 March 2008

Silverlight 2 Beta

I wanted to get my hands on Silverlight 2 beta, writing a sample app to understand the experience. I half expected Silverlight to be an enormous, complex, sophisticated platform rivaling WPF - after all, it was initially named WPF/E. On the contrary, I was surprised to see the number of simplifications to the framework. Here is a brief list of WPF features that are not available in SL 2.0:

  • Standard controls; like Button, TextBox, ListBox, CheckBox, etc.
  • Layout panels
  • Data binding
  • Templates
  • Styles
  • Commands
  • Routed events
  • A majority of events on elements (available in WPF)
  • A resource system based on merged resource dictionaries
  • Visual and logical trees (no programmatic construct represents them, at least)

Once I got past all those missing bits I found that what does currently exist is actually quite cool and useful.  The set of controls that are supplied look great and in the demo app they seem to work quite well.

I must admit, though, I really miss routed events.  With events such as tunneling and bubbling, working with normal CLR events is really limiting.  However, if I am correct, Microsoft intends on adding routed events into Silverlight 2.  The EventTrigger class exposes a RoutedEvent property as in WPF - it is possible that they named Siverlight’s EventTrigger’s property “RoutedEvent” to ensure that the Silverlight XAML compiles in WPF, but perhaps they actually intend on implementing routed events in the future.  Think about it, what sense would it make to have a property called RoutedEvent if routed events do not exist in Siverlight?

Another thing is that it is difficult, if not possible to use inheritance in a UserControl. According to the Silverlight.net forum, this is a "limitation". Even if the Base class inherits the UserControl class, you will see this error:

"Partial declarations of 'CLASSNAME' must not specify different base classes" in the file CLASSNAME.g.cs (g = generated). 

When you open the .g.cs file and remove the base class from it, the project compiles fine and also seems to work fine.

To address this issue, see this thread: http://silverlight.net/forums/p/10970/34988.aspx. As such, while it is possible, it has some peculiarities. For instance, when opening a file in Blend, it throws an error. When you have no need for that, it's no problem, but IMHO designers should still have the ability to change things in the design after I used inheritance on the control.

Additionally, when having multiple Silverlight pages (or applications as they are called now) in a single Silverlight Project it seems impossible to load any other than the default Page.xaml:   

- When using the "html" <object> method: it expects a parameter with a xap file, xaml files are not allowed
- asp:Silverlight control also needs a xap file. asp:xaml doesn't work
   
This could be my lack of experience in Silverlight 2, but again, it's my first impression. If I find a way this does work, I'll add it as a comment to this post. There is an option by setting an initParam with the name of the startup control you want to use. I'm not sure if I like this option, but it's a workaround.

I am also uncertain as to whether the Webclient is an improvement over the Downloader. For a simple thing as loading an image from a zip file: 

1.1 alpha code:

codesnippet1

2 beta code: 

codesnippet2

More lines of code, which doesn't necessarily mean that it's a worse solution than the SL1.1 one, but it definitely makes it more error prone. 

I think that MSFT wants to support bitmap effects such as those provided by Flash (blurring, etc). Maybe that's the reason they chose for the addition of a bitmap object. Time will tell.

Silverlight 2 beta is also inconsistent when it comes to relative URI.    The relative path should be the path from the root of the website, as it is in Silverlight 1.0 and 1.1.

In Silverlight 2 beta , the path in design is relative to the root of the site, but when running the app, it is relative to the location of the XAP file. So when downloading "thumbnails.zip" using the WebClient it looks for thumbnails.zip in the ClientBin folder instead of in the root of your website. 

Setting the WebClient.BaseAddress to the root of the site doesn't seem to work either.

   

04 March 2008

The RIA pattern

Rich user interfaces are appreciated by users; however, their design and implementation are much more challenging. Developers have to cope with frequent user interaction and more complex presentation logic and state. Rich Internet Applications (RIAs) come in different architectural flavors, depending on the technology and product, yet represent enabling the web and creating better, more usable, more interactive software, an idea that spans the browser, the desktop and mobile devices. As such RIA naturally represents another Web 2.0 Design Pattern.

How so? When you develop an RIA, it can consume services using any runtime(s) without changing code, providing developers the capability to change their underlying runtime or simultaneously consume services written in different runtimes without having to make changes to the application. Applications and their UIs can be built to work on any platform and browser, using the skills developers presently have. RIA applications can also help enterprises develop applications that seamlessly integrate with, and extend the value of their SOAs.

What, then, constitutes the RIA pattern? It supercedes the familiar Model-View-Controller pattern by adding a presentation model to the picture. The presentation model is the cornerstone for a clean, extensible and testable presentation layer. which overcomes most of the inherent disadvantages of MVC pattern, such as overly complex view code or poor testability. This provides a Model-PresentationView-View-Controller architecture providing a separation of concerns between state and data access/changes.

The typical structure of UI libraries are as trees of components objects which represent the UI and event notifications which reacts to user activity, providing a simple layering of presentation logic over business logic. However, this does not support modular UI building.

Complex UIs require hierarchical component structures, which contains application components (ACs). There are application-related, coarse-grained UI elements built from base components from the UI library. UI developer utilise ACs rather than the base UI components, ias they map more usefully to task assignments. These UIs allow for redundant access to system parts - different ACs can display shared state - and for synchronisation of ACs. The common state is represented by the model, while ACs trigger and observe model changes and update themselves accordingly.

It follows to ask where MVC fails in this. In MVC, the Model represents business state - presentation state is not represented. As such, in MVC, Models and ACs become conflated. For example, an Inventory AC must reference a Product Catalogue AC to access artefacts such as categories. As a result, the ACs are not decoupled in MVC - the Inventory AC cannot be developed, tested, or used with out the Product Catalogue AC.

In the RIA pattern, we want to fully apply MVC to every single AC. This leads to having a separate layer representing this concept - the presentation model. Yet, how are models structured? What states are stored in a model? What are the quality attributes of the presentation model, how do we structure ACs therein, and what framework support is useful and necessary?

With respect to structure, ACs form a tree - the root corresponding to a desktop window. All relevant AC is maintained in a single model, yet models can share referenced models. As such, the presentation model instances form a directed acyclic graph, which enables unique mapping from AC nodes to model graph nodes.

State management in the presentation model only reflects mutable UI states; the state model is abstracted, so that state representation boils down to primitive values for simple UI states, and referenced models for complex states.

Quality attributes of the presentation model include a fully observable model state, through event notification - ACs observe the mapped model and updating themselves accordingly. As such, when a model is initialy bound to an AC, it must synchronise its entire state with the AC; the model triggers a set of events to sync the AC. The AC obtains the mapped model at construction time, each implementing three parts: a) Code to build its UI subtree from base components, b) a Controller to propagate base component changes to the presentation model, c) a Controller to propagate model changes to the base component. This provides the bi-directional update between ACs and their models.

Where do frameworks come in? They are useful for providing templates for model structures and ACs. With model structures, this eases as well as standardises the implementation of models - abstracting super classes and interfaces for models, providing models for lists, undo/redo, etc. With templates for ACs we have abstract classes with standard capabilities, such as i18n, factories for base components and controllers.

What does this mean for developers? With the RIA pattern, UI frameworks perform additional work designing and implementing the presentation layer, along with any additional controllers, yet they free ACs to be implemented, tested and used independently. The UI code can be uniform, easing maintenance and ramp up time. Common capabilities are provided virtually for free. Dynamic attributes such as locale can be handled in straightforward manner. It is far easier to change UI libraries, given component independence. All this enables a far cleaner business layer to be provided, and far more can be tested and validated without either the UI or the data store in place.

In following posts I will look at what else is needed, how the RIA pattern handles access to business logic, and payload delivery considerations.

25 February 2008

Release the hounds: Flex 3 and AIR 1.0 are "on"

Flex 3.0 and Adobe AIR 1.0 have been released!

If you'd like to buy Flex Builder 3.0, it is available in two versions: Flex Builder 3 Standard and Flex Builder 3 Professional. Both are available from the Adobe online store: standard retails for US$249 US, Professional US$699. Upgrades are available as well - the details are available here.

Those purchasing Adobe Flex can receive a set of Flex, ActionScript and AIR posters by registering your product with Adobe. In Flex Builder 3.0 final select Help -> Register Flex Builder or go to this website. Register your copy, then follow the links to the form to request your set of posters, mailed to you free of charge. Along with the posters you'll receive offers for discounts from Adobe partners like Lynda.com, O'Reilly, Total Training, and Figleaf.

You can download a 60 day trial version of Flex Builder 3 Professional, with the option of subscribing to several Adobe email lists to help you with the trial. Subscribing to these messages will NOT subscribe you to other communications from Adobe, only those helpful tips to help you develop Flex applications. Also, if you use the above link, you won't have to login to Adobe.com to download Flex

For those of you just learning Flex, visit the new Flex 3 Getting Started wiki site. Its rather useful and will help get your first Flex application up and running.

Adobe also launched some new websites today. opensource.adobe.com is now a site for all of Adobe's work in the open source community, including the work with the Adobe Flex SDK. There's also a new microsite on Rich Internet applications.

Adobe user groups throughout the world will be holding launch events in the next few weeks. Check out this list of Adobe Flex user groups to find one near you, visit their website and join them for a great party and exclusive swag.

The Adobe Flex product page and the Adobe Flex developer center have undergone major renovations in an effort to simplify navigation.

The onAIR Tour is travelling Europe this spring. Make it to a tour event to learn more about Flex and AIR with Adobe evangelists.

Flex and AIR are on the web. They're on the desktop. And now you're well "on" your way to building great RIAs.

Tom Jordahl presents on BlazeDS

Tom Jordahl is presenting about BlazeDS to the ColdFusion Online Meetup on February 28. Anyone can join the Acrobat Connect room and the session will be recorded.
More details are available here.

The description:

Recently Adobe announced the release of BlazeDS which will make some key server technologies open source and free to use in any application. These technologies are critical to building great applications with Flex and AIR. Tom will talk about exactly what you get in BlazeDS and how it relates to LiveCycle Data Services and will detail some of the reasons why you might want to use these server technologies. He will also explain how ColdFusion developers can take advantage of BlazeDS in their applications.

09 February 2008

Rejection?

08 February 2008

Battle of the Planets - the EU OOXML saga

EU regulators have announced a third investigation into Microsoft's conduct on the desktop, the latest action demonstrating that while the EU has settled its earlier decade-long case against Microsoft, it remains as suspicious as ever regarding the software vendor's conduct, notwithstanding
Microsoft's less combative stance in recent years. The news can be found in a story reported by Charles Forelle bylined in Brussells this week.

According to the Journal, the investigation will focus on whether Microsoft "violated antitrust laws during a struggle last year to ratify its Office software file format as an international standard."  The article also says that the regulators are "stepping up scrutiny of the issue."  The Journal cites the following as the type of activity it will look into:

"In the months and weeks leading up to [last summer's vote on OOXML], Microsoft resellers and other allies joined standards bodies en masse -- helping swell the Italian group, for instance, from a half-dozen members to 85. Opponents said Microsoft stacked committees. People familiar with the matter say EU regulators are now questioning whether Microsoft's actions were illegal. Microsoft said at the time that any committee expansion had the effect of making more voices heard; it also said rival International
Business Machines Corp. mobilized on the other side of the vote."

 
A Microsoft spokesman referred to a statement issued last month, in which the company said it would "cooperate fully" with the EU regulator and was "committed to ensuring" the company is in compliance with EU law.

This newest investigation follows only one month after the EU announced two other investigations, one into the integration of Microsoft's Internet Explorer Web browser into Office and Windows over competing alternatives, and another relating to the degree and ease of interoperability that
Microsoft permits other vendors to achieve with Office.

The investigation will be especially welcome in standards circles, due to the wide range of reports from the field alleging misconduct by Microsoft, although, as noted in the Journal article, Microsoft has claimed that IBM has engaged in similar conduct.

It will be interesting to see where this leads.
 

LINKS