If you’ve read my article on Action Message Format (AMF) you’ll already know that AMF is a super-duper way to transfer data between a Flex/Flash/AIR application and its server-side counterpart. Essentially when the client application makes a call to a service, the server can return a Java (or PHP, Python, .NET) object and when it gets back to the Flex application, wallah, its converted into an identical object in ActionScript. Similarly, if the client application sends an ActionScript object to the server during a service call, it arrives as an identical Java object.
While that’s impressive, when it comes to implementation in a medium-to-high complexity system there are questions that still need to be answered. In this article, I’d like to address where to translate custom AMF classes.
…I want more!
Tags: amf, class adapters, coupling, Flex
Posted in Flex, General Programming | 8 Comments »
With the advent of Flex and RIA (Rich Internet Application) development came AMF (Action Message Format). Flex, in general, focuses only on front-end functionality, meaning it does not directly hit a database to store or retrieve persistent data. Instead, database calls are written in a more traditional back-end language like Java, PHP, Python, or .NET and such services are then exposed to be “consumed” (used) by the Flex front-end.
AMF is a protocol that allows ActionScript (the language of Flash/Flex) to call services exposed by the back-end. Additionally, if you choose, AMF allows you to translate a programmer-defined object between ActionScript and your back-end language of choice. In other words, if you have a customer class in ActionScript and you want to pass an instantiated customer object to the back-end, you simply call the exposed back-end service and pass the customer object as a parameter. The AMF layer transparently translates the ActionScript customer object into, let’s say, a customer object in Java. This functionality isn’t required. Instead of using a class you have defined, you could instead just send an integer to the backend as a parameter and, after processing, send a string back to the front-end. …I want more!
Tags: amf, AMFPHP, Flex, serialization
Posted in Flex, PHP | 1 Comment »