Every time I show one of my demos at a usergroup meeting, or just with a customer, the sound of jaws dropping is something I’ve gotten used to. It is not because of the fancy graphics, or the bug-free code (this is where the people who actually have seen my demos start laughing), but because of the cool things I do with data connectivity.
Data Connectivity? That’s the boring stuff!
I’ve been deploying more and more applications using a middleware server for Flex called LiveCycle Data Services. LCDS sits between your Flex or AIR applications and your back-end server such as ColdFusion. It allows things such as proxying (for those hard-to-reach web services), data management, AMF connectivity, and messaging.
AMF connectivity (also known as Flash Remoting, or RemoteObject Calls) allows you to use binary, serializable, data connections with your back-end server. No longer do you have to worry about the bloat and untyped object problems of Web Services SOAP calls, or pure XML dumps. This is what 90% of the developers are using BlazeDS or LCDS for. While cool, it is small potatoes for me.
Messaging allows the Flex clients to send and receive unsolicited messages to and from each other or an application server. On the surface it sounds boring, but have you ever had to build a chatting application? Your Flex, AJAX or JavaScipt application sits there, and POLLS your app server every x seconds for new data. This wastes lots of bandwidth and application processing power (because not every poll will contain new data), and makes the end user feel like there is stuff happening when there isn’t. And, if they use Internet Explorer, they will hear that dreaded ‘click’ each poll you do. Messaging via LCDS/BlazeDS allows you to setup ‘channels’ that your app or app server listen to and can publish to. If you need to send a real-time message to the client, all you do is publish data to that ‘channel’ and the end-client gets that message in real time. Not only can you send simple messages (strings, integers, etc), but you can also send complex objects, classes and other wacky data-types. I’ve seen an implantation that sent binary-encoded messages such as PNG screen shots back and forth! Many people use this feature to build apps like real-time dashboards or chatting apps.
And the coolest feature of them all, in my opinion is Data Management. Data Management allows developers to create managed collections (like the ArrayCollection), and have all the heavy-lifing of checking for updated data, sending revisions of data, etc. taken care of by LCDS. In literally two lines of code (minus configuration on the servers), I can write an app that will display data to the end-user in a DataGrid, Form, or Chart. And best of all, if that data is changed by any connected clients, or the application server, it will update the Flex application in real time! If I want to allow the user to edit the data, I can either write a simple form (which can update the server and all other connected clients as the user types), or simply change the DataGrid to be editable. No heavy lifting required. Introducing conflict management is simple, as your DataServices component will trigger events that tell you what is changing on the server as it happens. Paging and lazy-loading of data is simple too, requiring the server admin to change one switch. It really is that cool. Unfortunately, Data Management didn’t get open-sourced with BlazeDS.
So, why are you NOT using LCDS or BlazeDS?
- No good documentation : While the documentation isn’t as good as the rest of the Flex suite, it is out there. I suggest taking a look at the FusionAuthority magazine (the red, October edition), and you can read TWO of my articles on the subject. FusionAuthority will be launching Flex-Authority soon, and will be having much more content on the subject.
- Costs too much: While the full-blown version of LCDS is pretty expensive, lets say $3,000 per CPU (contact your Adobe Sales Rep for exact pricing), there is a FREE version that is limited to a single CPU, and an OpenSource version that includes many of the features of LCDS. LCDS-Express (the free edition) is included with the ColdFusion 8 download.
- Too hard to configure: It can be intimidating at first, but the configuration grows on you. The configuration files are written in XML, and are broken up by service type. You will find the configuration in your (application home)/WEB-INF/flex/ directory. Look for the services-config.xml file to start. ColdFusion users can find the configuration in the (coldfusion root)/wwwroot/WEB-INF/flex/ directory. You can find examples on how to configure the files in my FusionAuthority articles.
Want to find out more? Check out my usergroup’s presentation archive; there were two presentations on the matter, OR you can wait for FlexAuthority to come around.