| By Marco Casario | Article Rating: |
|
| February 27, 2008 09:00 AM EST | Reads: |
8,393 |
I'm currently creating many small applications using AIR and Flex 3. Most of them are prototypes with the purposes of showing AIR features and the quantity of code is small (600 lines at most).
In this context it does not make much sense to use a framework or architecture such as Cairngorm or PureMVC or Defraga. So that I'm using a lot what in JSP is called the View Helper pattern.
The view components of your AIR and Flex applications, that will only contain the controls that define the user interface of the application, will use a simple View Helper, consisting in an ActionScript class, to encapsulate business logic in a helper instead of a view, making our application more modular by facilitating component re-use.
A view contains formatting code, delegating its processing responsibilities to its helper classes, implemented as an Actionscript class. Helpers also store the view's intermediate data model and serve as business data adapters.
View helpers has the following advantages:
- improve the separation between the presentation and the business data actinga as intermediaries between the two
- most of the code contained in a view components is merely mxml code
- the code within the view components are more readable and a designer can browse and edit it to change the visual aspects of the application in an easy way
- it can cache lookup tables for the application
To invoke a view helper you can simply
<h:UploadHelper id="uploadHelper" xmlns:h="com.comtaste.proto.controls.*" />
and the view helper UploadHelper class is an ActionScript class where you'll encapsulate the business logic of view component :
package com.casario.proto.controls
{
import flash.events.Event;
import flash.events.IOErrorEvent;
import mx.controls.Alert;
public class MainHelper
{
protected var URLString:URLRequest =
new URLRequest("http://www.domain.com/file.jsp");
[Bindable]
private var statusStr:String = new String("");
public function MainHelper()
{
super();
}
}
}
If you want to have more details and ivestigate on this pattern you can visit the View Helper Design Pattern of J2EE.
Published February 27, 2008 Reads 8,393
Copyright © 2008 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Marco Casario
Marco Casario is CEO of Comtaste, a company devoted to develop Rich Internet Applications on the Web and for mobile devices.
He collaborates intensively with Adobe Italy as a speaker at conferences and as a consultant for Flash, Flex, and Flash Lite.
Learn more about Marco Casario at his blog http://casario.blogs.com. In 2005, Marco has founded Comtaste, a company dedicated to exploring new frontiers in Rich Internet Applications and the convergence between the web and the world of mobile devices — MobyMobile and YouThru are representative of their recent work. He is founder of the biggest worldwide Flash Lite User Group and of www.augitaly.com, a reference point for the Italian community of Adobe users, in which he carries out the role of Channel Manager for the section dedicated to Flex.
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- Kindle 2 vs Nook
- Why IBM’s Server Chief Got Busted
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing Journal Opens "Readers' Choice Awards" Nominations
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- Industry Experts Discuss the State of Cloud Computing
- It's the Java vs. C++ Shootout Revisited!
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- The End of IT 1.0 As We Know It Has Begun
- An Introduction to Abbot
- Java Kicks Ruby on Rails in the Butt
- Interviewing Java Developers With Tears in My Eyes
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- 1st Annual Government IT Expo: Call for Papers Deadline July 15
- How to Diagnose Java Resource Starvation
- REA Is Where RIA Becomes the Norm
- Kindle 2 vs Nook
- Anatomy of a Java Finalizer
- Why IBM’s Server Chief Got Busted
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- The i-Technology Right Stuff
- JavaServer Faces (JSF) vs Struts
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- What's New in Eclipse?



































