I had a pleasant surprise this morning after I decided to pop in and see how the
AMFPHP was getting on, it turns out very nicely thank you and I wish I had popped in 8 months ago when it came out of beta!
For those of you that don't know
AMFPHP is an open source project which is very like
Flash Remoting Server in that it allows you to more
tightly bind a flash application to an application server. There are several reasons why this is a good thing but there are also several reasons why we have never used it in the past even though, as Flash users, it is a powerful tool to have around.
In the beginning there was
Flash Remoting Server, it cost a lot of money (-1), it tied you to
Cold Fusion as your application server (-2) and it tied you to
Flash as a front end(-3). Now I like
Flash as a web app programming tool for several reasons, its cross platform, its very readily available, its quite quick and the
run time is free, so as a means for creating small web based or intranet based apps its very nice. The problem I have always had with
Flash is that it may not be around for ever and I
don't want to get tied to it just in case it is
superseded also the server side kit from
Macromedia as was very expensive. So when we started developing these applications we used
Flash for the front end but
PHP on the server and always used XML to communicate data backwards and forwards leaving the door open to AJAX, JAVA or anything else we might want to use as a front end.
The only downside to using XML is speed, one very nice thing which I have been using more recently is the XML formatting functions on Microsoft
SQL server which meant that there was no need to assemble an XML document from the query data using
PHP, simply run the query and send it off to the client. However once this arrived often there are quite
complicated functions used to extract the data from XML and display it which
Flash was not so hot at sometimes.
So long story short I found that
AMFPHP is on release 1.2 with a 1.9 in Beta, installed it in about 5 minutes and had a basic application running in 10. The real change from my point of view is that it is now compatible to a greater or lesser extent with AJAX and Javascript which is great news. So I have spent the rest of the day looking at how much more efficiently this approach can be used to send data backwards and forward between client applications and the server than XML.
The answer is much quicker in 2 respects, firstly the data is serialised at both ends and transmitted as binary data so the latency is much reduced, also as the data arrives at the client side as native data types processing is quicker and much more straight forward. Suddenly the data binding in
Flash standard
components makes sense! Writing the code is much more straight forward when you get your head around the way that server side classes are constructed and how the information arrives, so much so that a page of programming 250 lines long becomes a far nicer 40 lines long with another 30 odd on the server side. If you program in
Flash you need this! I have taken the liberty of linking to the
showcase page which lists some great sites apparently using
AMFPHP in the wild :o)