| By Marco Casario | Article Rating: |
|
| February 27, 2008 09:00 AM EST | Reads: |
10,368 |
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 10,368
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.
- It's the Java vs. C++ Shootout Revisited!
- Patterns for Building High Performance Applications
- Asynchronous Logging Using Spring
- Java for Programmers (2nd Edition)
- Cross-Platform Mobile Website Development – a Tool Comparison
- Three Buzzwords That Every CIO Hears but One They Should Listen To
- Write Once Run Anywhere or Cross Platform Mobile Development Tools
- Immersing into JavaScript Frameworks
- Workday Reportedly Prepping to Go Public
- Cloud Expo New York: The Java EE 7 Platform - Developing for the Cloud
- Book Review: Sams Teach Yourself Java in 24 Hours
- OpenOffice.com Lives
- Book Excerpt: Introducing HTML5
- Adobe Sends Flex to the Apache Foundation
- Five Years Waiting for JRE 7: Is It Justified? (Part 1)
- Book Excerpt: Java Application Profiling Tips and Tricks
- i-Technology in 2012: Five Industry Predictions
- It's the Java vs. C++ Shootout Revisited!
- Patterns for Building High Performance Applications
- OpenXava 4.3: Rapid Java Web Development
- The Next Web Architecture
- Asynchronous Logging Using Spring
- Java for Programmers (2nd Edition)
- Is Write Once Run Anywhere Ever Going to Be a Reality?
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- JavaServer Faces (JSF) vs Struts
- The i-Technology Right Stuff
- 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
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- What's New in Eclipse?
- i-Technology Predictions for 2007: Where's It All Headed?


















