Ria Development With Flex And PHP


Published on

My slides from ZendCon 2008 on Rich Internet Application Development using Zend Framework, PHP, and Adobe Flex.

Published in: Technology
1 Comment
  • Hi, is it possible that you publish the presentation for Download? Thx!
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Ria Development With Flex And PHP

  1. 1. Building RIA with Zend Framework and PHP John Coggeshall Automotive Computer Services
  2. 2. <ul><li>Who am I: John Coggeshall </li></ul><ul><ul><li>Chief Technology Officer, Automotive Computer Services </li></ul></ul><ul><ul><li>PHP Core Contributor </li></ul></ul><ul><ul><li>Former Sr. member of Zend Technologies Global Services </li></ul></ul><ul><ul><li>Author, geek, etc. </li></ul></ul>Welcome Jun 4, 2009 | |
  3. 3. Agenda today <ul><li>Today we’re going to talk about building RIA applications in PHP </li></ul><ul><ul><li>Specifically using Adobe Flex / AIR and PHP / Zend Framework </li></ul></ul><ul><li>Discuss everything about creating the application </li></ul><ul><ul><li>Development Environment and Tooling </li></ul></ul><ul><ul><li>Client-side Architecture </li></ul></ul><ul><ul><li>Server-side Architecture </li></ul></ul><ul><ul><li>Pulling it together </li></ul></ul><ul><ul><li>Demos </li></ul></ul>Jun 4, 2009 | |
  4. 4. Our Challenge <ul><li>ACS has an existing system for managing car dealerships nationwide </li></ul><ul><ul><li>Pure Client-side </li></ul></ul><ul><ul><li>Really old (written in Visual FoxPro!) </li></ul></ul><ul><li>Current goal: Complete re-implementation of product as a thin-client application </li></ul><ul><ul><li>Need to retain desktop-like functionality </li></ul></ul><ul><ul><li>Adobe AIR / Flex was selected as our GUI </li></ul></ul>Jun 4, 2009 | |
  5. 5. Why Flex? Why AIR? <ul><li>Originally numerous options were considered for the front-end </li></ul><ul><ul><li>HTML/JS using FireFox 3 </li></ul></ul><ul><ul><li>XUL / JS </li></ul></ul><ul><li>Flex offered the most reasonable rich-client solution </li></ul><ul><ul><li>Extremely Rapid UI Development when compared to HTML / JS </li></ul></ul><ul><ul><li>Much more extendable / customizable then XUL / JS </li></ul></ul><ul><li>AIR gave us more client-side flexibility </li></ul><ul><ul><li>Access to Local file system </li></ul></ul><ul><ul><li>Access to local Hardware (or at least, we had options) </li></ul></ul>Jun 4, 2009 | |
  6. 6. Our Technology Stack <ul><li>Our Development Environment: Zend Studio for Eclipse with numerous plug-ins </li></ul><ul><ul><li>Flex Builder 3 Pro Plug-in </li></ul></ul><ul><ul><li>LogWatcher (GUI tail –f) </li></ul></ul><ul><li>VMWare Virtual Machine for server </li></ul><ul><ul><li>CentOS powered running Zend Core </li></ul></ul><ul><ul><li>MySQL 5.x database </li></ul></ul><ul><li>Our Development Stack </li></ul><ul><ul><li>Server: PHP 5.2 w/ Zend Framework 1.6 </li></ul></ul><ul><ul><li>Client: Adobe Actionscript 3 / Flex w/PureMVC </li></ul></ul>Jun 4, 2009 | |
  7. 7. Client-Side Architecture <ul><li>Based on PureMVC </li></ul><ul><li>( http://www.puremvc.org ) </li></ul><ul><ul><li>Singleton Controller, Model, View </li></ul></ul><ul><ul><li>Views are managed by Mediators </li></ul></ul><ul><ul><li>Models are implemented by Proxies </li></ul></ul><ul><ul><li>Controller actions are implemented through Commands </li></ul></ul>Jun 4, 2009 | |
  8. 8. Client-side Architecture <ul><li>Primary communication via Notify/Observer pattern </li></ul><ul><ul><li>(Proxies cannot observe) </li></ul></ul><ul><li>Mediators bridge between Flex’s event model and the application </li></ul><ul><li>Proxies communicate with data sources </li></ul>Jun 4, 2009 | |
  9. 9. Server-Side Architecture <ul><li>RESTful services (currently) using e4x as its data transport </li></ul><ul><ul><li>e4x is well supported in Flex, very easy to work with </li></ul></ul><ul><ul><li>Looking into AMF support in the near future (Zend_Amf) </li></ul></ul><ul><li>MVC pattern with one controller </li></ul><ul><ul><li>Action specifies the version </li></ul></ul><ul><li>Controller Maps the request URI to a class implementing the Command pattern </li></ul><ul><ul><li>Uses Zend Framework’s Plugin Architecture </li></ul></ul>Jun 4, 2009 | |
  10. 10. Server-Side Architecture <ul><li>http://host/service/v1/command/auth.login </li></ul><ul><ul><li>Maps to the ACS_Command_Auth_Login class </li></ul></ul><ul><ul><ul><li>The execute() method is called </li></ul></ul></ul><ul><ul><ul><li>Located in ACS/Command/Auth/Login.php </li></ul></ul></ul><ul><ul><li>Commands are given a reference to Zend_Controller as well to provide context </li></ul></ul><ul><ul><ul><li>Full access to request, etc. </li></ul></ul></ul><ul><ul><li>Views are also then mapped to command name </li></ul></ul><ul><ul><ul><li>I.e. auth-login.xml.phtml </li></ul></ul></ul>Jun 4, 2009 | |
  11. 11. Server-Side Architecture <ul><li>Wanted to have the ability to allow front-end engineers to work without needing real services </li></ul><ul><li>Solution: Implement a dummy-xml ability into our services by including the ?dummy=1 GET parameter in our request </li></ul><ul><li>Behind the curtain, our ZF architecture will automatically find a dummy .xml file for a response </li></ul>Jun 4, 2009 | |
  12. 12. Pulling it together <ul><li>Now that we have both sides how can we more cleanly tie them together? </li></ul><ul><ul><li>Already have a single IDE to do all development in </li></ul></ul><ul><li>Extending the ActionScript HttpClient class to incorporate more stuff </li></ul><ul><ul><li>Enhancement #1: No need to specify a URL, just the service name </li></ul></ul><ul><ul><li>Enhancement #2: Built-in support for “dummy” service requests </li></ul></ul><ul><ul><li>Enhancement #3: Support for the Zend Studio Debugger </li></ul></ul>Jun 4, 2009 | |
  13. 13. End-to-End Debugging and Profiling <ul><li>Flex has a great Debugger / Profiler for Flex </li></ul><ul><li>Zend Studio for Eclipse has a great Debugger / Profiler for PHP </li></ul><ul><li>By extending the HttpClient Class, we can create a seamless end-to-end debug or profiling session using real web service requests </li></ul><ul><li>Already has saved us once hunting a very nasty bug </li></ul>Jun 4, 2009 | |
  14. 14. What more can we do? <ul><li>Web service developers need to document their services </li></ul><ul><li>We need to create application usage documentation </li></ul><ul><li>All documentation is written in DocBook format and stored in the repository </li></ul><ul><ul><li>Developer guide can be seamlessly integrated into Eclipse using a custom Plugin </li></ul></ul><ul><ul><li>User Guide can be converted into HTML and shipped with product in chunk format (contextual help) </li></ul></ul>Jun 4, 2009 | |
  15. 15. Demo <ul><li>Let’s see a demo of everything in action! </li></ul>Jun 4, 2009 | |
  16. 16. What do we dislike? <ul><li>As you can tell we’re very happy with AIR/Flex for the most part.. </li></ul><ul><li>What is bad? </li></ul><ul><ul><li>Deferred Instantiation can be a real pain </li></ul></ul><ul><ul><li>Sort of a memory / resource hog </li></ul></ul><ul><ul><li>Very easy to do write bad code in Flex </li></ul></ul><ul><ul><li>Lack of a fully-baked Unit Testing facility </li></ul></ul>Jun 4, 2009 | |
  17. 17. Thank you! Questions?