Welcome!

Machine Learning Authors: Liz McMillan, Yeshim Deniz, Pat Romanski, Elizabeth White, Corey Roth

Related Topics: Adobe Flex, Java IoT, Machine Learning

Adobe Flex: Article

One Approach to Enterprise Adobe Flex Development

Typical challenges and solutions of enterprise Flex/Java projects

During the last several years our company, Farata Systems have architected and developed a number of Flex projects ranging from creating widgets for startups to large applications having two hundred views. Some projects were created from scratch, and we had a luxury to do it our way. In some cases we had to pick up the code left by other developers.

Three years ago Adobe Flex has been completely revamped (I’m referring to Flex 2) and nobody knew about it. But today, the word Flex doesn’t make Java developers angry any longer. Java/Flex projects are considered business as usual. Many enterprise Java developers went through Flex training and are ready to roll up their sleeves…

After spending 10+ years with Java I can easily put myself in the state of mind of Java developers - they often start with selecting the right framework. As a matter of fact, our perspective customers often request to include an item "Flex framework analysis and recommendations" in the agenda of our very first joint meeting. Here’s a typical conversation that takes place during such meetings:

"Yakov, we have a team of experienced Java developers and some of them have exposure to Flex. Which Flex MVC framework do you recommend? By the way, does the ABC framework support XYZ functionality?"
“No, MVC-based frameworks don't support any additional functionality that doesn’t exist in Flex. Their goal is to rearrange your code and change the way components of your RIA communicate with each other. But why do you need an MVC framework for your project?”
“Well, everyone’s using them. Having a framework makes the project development more structured and organized.”

Is it so?

Most of the Flex MVC frameworks are intrusive and require developers to write additional code just to support the life cycle of the framework itself. Usually, they are built on singletons, and this complicates modularization of the RIA. I’ve been writing and speaking against Flex MVC frameworks for years, and if you’d like to read a detailed analysis and comparison of some of them, read the first chapter of the book “Enterprise Development with Flex”.
Last year at MAX ’08 conference, I participated in the panel “The Flex architecture faceoff”. Two out of four panelists (Chafic Kazoun and yours truly) were advocating component-based approach without squeezing a RIA inside any MVC framework. It was a lively discussion, and you can listen to its recording at http://tv.adobe.com/#vi+f15384v1055

At this point you may say, “OK, it’s easy to critique frameworks, but how do you approach development of a new project especially while having a distributed team of developers with minimal exposure to Flex?”
And I’m glad you’ve asked this question.

In this article I’ll try to identify common artifacts that exist in literally every Flex enterprise project. I’ll also highlight major principles and introduce you to a component-based approach that our developers use in almost every project.

Flex to Java Communication Protocols

The role of Java side of RIA is to deal with data: get the data from a DBMS, a Web Service or any other data source and deliver it to the Flex client as quickly as possible. The fastest way of arranging Java-Flex data exchange is AMF or RTMP protocols. The open source AMF protocol is built on top of HTTP and it offers efficient data serialization between Flex and Java. RTMP offers faster socket-based full duplex communication.

If you install an open source server-side component BlazeDS under a servlet container of your choice, or will use Granite Data Services - AMF will be your only option for data transfer. Commercial LiveCycle Data Services ES (LCDS) will give you both RTMP and AMF implementations. LCDS will also offer you an automated way of data synchronization between Flex and Java.
There is a small number of high performing enterprise applications that would really benefit from using RTMP protocol, and beside using LCDS, an open source server Red5 may become the only alternative.

Note. RTMP protocol is also widely used for streaming video, but these applications are out of the scope of this article.

Challenges of Flex/Java enterprise projects

Let’s dissect a typical enterprise application that’s built with Flex on the client and Java on the server. If you are leading such a project, it’ll present the following tasks, needs, haves, and nice to haves:

1. Keep track of changes that the user makes via UI controls and send modified data to the server
2. It’ll have a number of views that will display the data in the form of grids
3. It’ll have a number of views that will contain forms
4. Some views will represent master-detail relations, i.e. selection of a row in a grid has to display the detail information in a form container.
5. The data grid columns will need custom item renderers ranging from centered checkboxes to dropdowns populated with some reference data by making a separate remote call to the server.
6. It would be nice if a form component could have its own data provider similar to the one that List-based controls use.
7. Data forms must be validated and it would be nice to have
a) reusable validators (i.e. two date fields should be able to reuse the same instance or the Validator object)
b) embedded validators, encapsulated in component such as DataGrid.
8. The main view of your application must appear on the user’s screen ASAP even if they have slow Internet connections.
9. The data changes made by one user may need to be automatically synchronized with the server and notification of the changes should be sent to other users potentially looking working with the same data set at the moment. This functionality is supported by Data Management Services in LCDS, but you may want to have the same functionality in open source BlazeDS.
10. If you are building an AIR/BlazeDS application, you need to come up with a custom solution for automatic data synchronization for occasionally connected applications.
11. Printing is an Achilles heel of Flex. You’d like to be able to generate PDF on the client for your Flex/BlazeDS or disconnected AIR applications.
12. Since your modularized application may consist of five-ten-fifteen Flash Builder projects, writing build scripts becomes a project in its own. Can writing script be automated?
13. Your Flex project may need to consume a dozen or more of Java data transfer objects hence you need to develop the same number of ActionScript classes for efficient data serialization. During the project development cycle the structure of these DTOs may change if not daily, then weekly. An automation tool for generation of DTOs can save you some project development time.
14. Some of the views in your application represent CRUD functionality and using code generators or wizards that lower the amount of manual coding is highly desirable.
15. How do I link all these libraries – RSL/Merge-in/External? Should I use Flex SDK as RSL?

Over the years, we at Farata Systems came up with our solutions to all of the items from the above laundry list. At this point every other reader would exclaim, “Finally, here comes the selling part. I knew it!”
Wrong! All of the components implementing the above functionality not only are available for free, but we also open sourced them as Clear Toolkit framework and (see SourceForge at https://sourceforge.net/projects/cleartoolkit/ ).
Now I will write yet another list of solutions that you might want to research further. By the way, even though we call our components a framework, you can use most of them ala cart.

How we deal with challenges of Flex/Java enterprise projects

We’ve created and are happy to share with the community a number of handy classes, tools, and techniques. You can get the code, which has been open sourced, and you can read our books and articles describing how to use them.

I’ll give you quick references that help in finding solutions to the above challenges (I’ll keep the same order and numbering).

1. Clear Toolkit has a library clear.swc, which has a component DataCollection that supports automatic tracking of the user changes. Look at the ChangeObject class – we’ve implemented it similarly to the one in LCDS, but ours can be used with BlazeDS too. If you need to make your updates transactional, use the BatchService class.
2. We use DataCollection (a subclass of ArrayCollection) as a data provider for data grids. Besides keeping tracks of changes, it encapsulates Flex remoting and reduces the amount of manual coding.
3. Research the DataForm component. Read about it in the sample chapter mentioned at the end of this article.
4. DataCollection supports proper updates in Master-Detail scenarios (see http://flexblog.faratasystems.com/?p=407).
5. Read about resources in the sample chapter mentioned at the end of this article.
6. Read about DataForm component in the sample chapter mentioned at the end of this article.
7. Read about Validator component in the sample chapter mentioned at the end of this article.
8. Read about custom preloaders and how to build every application as a mini-portal with a light-weight starting application in Chapter 8 of the upcoming O’Reilly book.
9. Read about DataCollection in general and hierarchical data collections with deep data synchronization in particular (http://flexblog.faratasystems.com/?p=407)
10. Read about the OfflineDataCollection (Chapter 9 of the upcoming book) and see a pre-recorded demo of a sample application that’s using it (http://flexblog.faratasystems.com/?p=394 ).
11. Explore the Clear Toolkit’s package com.farata.printing – it includes extended Flex components that can expose themselves in a format suitable for PDF generation. Read chapter 11 of the upcoming book for more details and samples.
12. An approach and techniques of minimizing the download time is described in Chapter 8 of the upcoming book.
13. Explore our DTO2Fx code generator that comes with Clear Toolikt: https://sourceforge.net/projects/cleartoolkit/files/
14. Read about Clear Data Builder 3.1 that can generate the entire CRUD application based on either SQL or arbitrary Java DTO’s at https://sourceforge.net/projects/cleartoolkit/files/
15. Read chapters 7 and 8 about linking libraries and loading modules in Flex RIA.

Where can I learn more about these solutions?

First, you can read the book Rich Internet Applications (http://riabook.com/) with Adobe Flex and Java that I co-authored with Anatole and Victor, my colleagues at Farata.

Second, you should read an upcoming O’Reilly book Enterprise development with Flex, written by the same authors.

Third, you may explore the source code of Clear Toolkit components and use the tools published at SourceForge.

Fourth, we invite you to enroll in Advanced Flex trainings, seminars and symposiums that we run on a regular basis. During these events we demonstrate most of the techniques mentioned above as well as our latest findings. Find the up-to-date information about such events under the Training section at http://faratasystems.com/

Fifth, read our blog at http://flexblog.faratasystems.com


To get a better feeling about the functionality of some of the extended Flex components, please read the sample chapter of the upcoming book Enterprise development with Flex. O’Reilly decided to publish this chapter as a three-part blog under my name, but I was only one of three co-authors, and all of us are accountable for these texts. Read the sample chapter here:

Part 1. http://www.insideria.com/2009/05/chapter-preview-building-an-en.html
Part 2. http://www.insideria.com/2009/05/building-an-enterprise-framewo.html
Part 3. http://www.insideria.com/2009/05/building-an-enterprise-framewo-1.html

Summary

I just want to give a full credit to my colleagues, excellent software engineers at Farata that work day in and day out on enhancing the functionality of Flex components and decreasing the amount of manual coding required by application programmers. Open sourcing our component have allowed us to bring more people to testing (our big thanks to people who use Clear Toolkit and report issues and make suggestions at Source Forge forums).

We invite Flex and Java developers to become active contributors and submit their version of enhanced components to make Clear Toolkit, a real platform for all who value open source solutions. There are no geniuses that can beat the collective intelligence!

More Stories By Yakov Fain

Yakov Fain is a Java Champion and a co-founder of the IT consultancy Farata Systems and the product company SuranceBay. He wrote a thousand blogs (http://yakovfain.com) and several books about software development. Yakov authored and co-authored such books as "Angular 2 Development with TypeScript", "Java 24-Hour Trainer", and "Enterprise Web Development". His Twitter tag is @yfain

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


CloudEXPO Stories
CloudEXPO New York 2018, colocated with DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
The best way to leverage your Cloud Expo presence as a sponsor and exhibitor is to plan your news announcements around our events. The press covering Cloud Expo and @ThingsExpo will have access to these releases and will amplify your news announcements. More than two dozen Cloud companies either set deals at our shows or have announced their mergers and acquisitions at Cloud Expo. Product announcements during our show provide your company with the most reach through our targeted audiences.
DevOpsSummit New York 2018, colocated with CloudEXPO | DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City. Digital Transformation (DX) is a major focus with the introduction of DXWorldEXPO within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term.
Traditional on-premises data centers have long been the domain of modern data platforms like Apache Hadoop, meaning companies who build their business on public cloud were challenged to run Big Data processing and analytics at scale. But recent advancements in Hadoop performance, security, and most importantly cloud-native integrations, are giving organizations the ability to truly gain value from all their data. In his session at 19th Cloud Expo, David Tishgart, Director of Product Marketing at Cloudera, covered the ins and outs of Hadoop, and how it can help cloud-based businesses.