Best Practice of RIAs Architecture                  - RIA MVCWeb technologyPresented by Jie GaoEngineering and Computer ScienceAcademic Year 2011
AgendaTraditional Web MVCRIA MVCService-Side TransformationCurrent RIA MVC FrameworksConclusion
Comparison with traditional Web MVC(1)                         Server-side MVCUser -> Controller -> View -> UserUser -> Controller -> Model -> View        -> UserAdvantage:Very userful when application client-side capabilities requirements are poorDisadvantage:Cannot update part of a View
Increase bandwidth usage
Cause the server to be busyComparison with traditional Web MVC(2)		Mixed client-side and server-side MVCUser -> Controller (Client) -> View (Client) ->UserUser -> Controller (Client) -> Controller(Server) ->View (Server) -> View (Client) ->User User -> Controller (Client) -> Controller(Server) -> Model -> View (Server) -> View(Client) -> User (1)The second mixed MVC is widely used.Increase more client-side capabilities
Decrease bandwidth usage and the     server overridingForm validations and conditions are processed at client-side
Able to use AJAX
Able to use a RIA plug-in at client-side for avoiding multi-version problems(2)
Comparison with traditional Web MVC(3)The architectural shift from server-side web MVC towards RIA                    represented by Struts and still the world of Server-side MVCIt is not problem free:Computation for tasks requiring access to the server-side MVC are slowDifficult to program and maintain client-side Model (necessary to deploy different code per client platform like browser, OS, other devices)Over-heading on communication among MVC design elements
RIA MVC1)User -> Controller -> View -> User2) User -> Controller -> Model (Client     ) -> View-> User3) User -> Controller -> Model (Client) ->    Model (Server) -> View -> UserAdvantage:The page is sent once and quick response to the userUpdating the model at client minimizes the bandwidth usageCommunication of Models between client and server sides is able to asynchronous and transparent to the user(client-side model take the decision)Take full advantage of the processing capabilities and resources at client-sideUpdate part of the View at client-side easierDeficiency:Remain the problem of multiple client-side platformsPlug-ins may solve this situation extending browsers capabilities
Service-Side Implicationin RIAs(best practice)turn the server into an generic APIprovide RESTful web-servicesopen up the application for other clientsEnable:Development of other GUIsIntegration with other toolsScriptability and automationEasier to develop clients with different capabilities(different clients that use the same server services)
Current RIA MVC Frameworks							http://www.flickr.com/photos/joost-ijmuiden/
Current RIA MVC Frameworksbrowser-based SolutionsJavaScriptMVCDOJOSproutCore(HTML5)PureMVC  framework for JavascriptCorMVCJamal(Ruby on Rails style)And many more…flash-based SolutionsPureMVCframework for AS3
Cairgorm  micro-architecture
Mate
FlexMVCS(make PureMVC more  suitable for Flex)
Swiz(uses dependency injection)

Ria Mvc

  • 1.
    Best Practice ofRIAs Architecture - RIA MVCWeb technologyPresented by Jie GaoEngineering and Computer ScienceAcademic Year 2011
  • 2.
    AgendaTraditional Web MVCRIAMVCService-Side TransformationCurrent RIA MVC FrameworksConclusion
  • 3.
    Comparison with traditionalWeb MVC(1) Server-side MVCUser -> Controller -> View -> UserUser -> Controller -> Model -> View -> UserAdvantage:Very userful when application client-side capabilities requirements are poorDisadvantage:Cannot update part of a View
  • 4.
  • 5.
    Cause the serverto be busyComparison with traditional Web MVC(2) Mixed client-side and server-side MVCUser -> Controller (Client) -> View (Client) ->UserUser -> Controller (Client) -> Controller(Server) ->View (Server) -> View (Client) ->User User -> Controller (Client) -> Controller(Server) -> Model -> View (Server) -> View(Client) -> User (1)The second mixed MVC is widely used.Increase more client-side capabilities
  • 6.
    Decrease bandwidth usageand the server overridingForm validations and conditions are processed at client-side
  • 7.
  • 8.
    Able to usea RIA plug-in at client-side for avoiding multi-version problems(2)
  • 9.
    Comparison with traditionalWeb MVC(3)The architectural shift from server-side web MVC towards RIA represented by Struts and still the world of Server-side MVCIt is not problem free:Computation for tasks requiring access to the server-side MVC are slowDifficult to program and maintain client-side Model (necessary to deploy different code per client platform like browser, OS, other devices)Over-heading on communication among MVC design elements
  • 10.
    RIA MVC1)User ->Controller -> View -> User2) User -> Controller -> Model (Client ) -> View-> User3) User -> Controller -> Model (Client) -> Model (Server) -> View -> UserAdvantage:The page is sent once and quick response to the userUpdating the model at client minimizes the bandwidth usageCommunication of Models between client and server sides is able to asynchronous and transparent to the user(client-side model take the decision)Take full advantage of the processing capabilities and resources at client-sideUpdate part of the View at client-side easierDeficiency:Remain the problem of multiple client-side platformsPlug-ins may solve this situation extending browsers capabilities
  • 11.
    Service-Side Implicationin RIAs(bestpractice)turn the server into an generic APIprovide RESTful web-servicesopen up the application for other clientsEnable:Development of other GUIsIntegration with other toolsScriptability and automationEasier to develop clients with different capabilities(different clients that use the same server services)
  • 12.
    Current RIA MVCFrameworks http://www.flickr.com/photos/joost-ijmuiden/
  • 13.
    Current RIA MVCFrameworksbrowser-based SolutionsJavaScriptMVCDOJOSproutCore(HTML5)PureMVC framework for JavascriptCorMVCJamal(Ruby on Rails style)And many more…flash-based SolutionsPureMVCframework for AS3
  • 14.
  • 15.
  • 16.
    FlexMVCS(make PureMVC more suitable for Flex)
  • 17.
  • 18.
  • 19.
  • 20.
    And many more…CurrentRIA MVC Frameworks -javaScriptMVC(1)There are only 4 things you will ever do with JavaScript! JMVC breaks these down into the Model-View-Controller architecture.Respond to events -> Controller($.Controller)Get data and manipulate services (Ajax) -> Model Static functions($.Model)Wrap service data with domain specific information -> Model Prototype functions(e.g. attr, bind)Update the page -> Controller and View
  • 21.
    Current RIA MVCFrameworks -javaScriptMVC(2)Strength:Enhance code quality, performance, and maintainabilityLocally separate javascript filesLibrary interdependence->light enough to change to another libraries such as jQuery or PrototypeTesting->Provide browser-based and command-line approach to perform unit/functional test to facilitate the UI testError handling->Plenty of plugins support in firefox to check errors(e.g. typing error or grammar)It is about how to build an applicationWeakness:based on jQuery, maybe some issues evoked by jQueryNot suitable for small applications
  • 22.
    Current RIA MVCFrameworks-PureMVC(1)PureMVC provides the model, view, and controller just as expected but hides them behind a global Facade layer with mediators and proxies to manipulate them
  • 23.
    Current RIA MVCFrameworks-PureMVC(2)Benefits:can be used for 11 kinds of language(e.g. c#,java,javascript,python,as2/as3)Avoid platform dependenciesPattern-based(implemented in any OOP env and easy to understand)Facade class provides a single collaborator for communication with the core frameworkLoosely-coupled framework(e.g. publish/subscribe style notifications)Well-documentedHowever,PureMVC does not leverage native Flex features(e.g. event delegation model, Flex binding)PureMVC is not tied to Flex or even ActionScript
  • 24.
    Current RIA MVCFrameworks -Cairngorm(1)Model:Stored in singleton ModelLocatorView(mxml):All data is pulled from model via bindingController:Tie Events and Commands together in Controller class
  • 25.
    Conduit between userevents and model changesCurrent RIA MVC Frameworks -Cairngorm(2)Benefits:Leverage the underlying Flex frameworks(e.g. central event dispatcher and business delegates)Well-supported and active community of developersBorrow plenty of proven strategies from JAVA development worldsEasier for medium to large teams of software engineersEasier to deliver large scale, mission-critical RIAsWeakness:work it with a lot of classes(e.g. each event maps to a command)Relative long learn curveComplicate the built-in Flex event model and cause some limitationsHeavily reliance on global singletons making modularization and unit testing difficult
  • 26.
    ConclusionA general guidelinesto choose a RIA MVC framework:Help build complex applications fasterSupport team developmentSupport code reuseSupport maintainability and extensibilityShort learn curveWell-document supportOn the basis of:Business requirementTarget platformExperience of the development group
  • 27.
    ReferenceMorales-Chaparro, R.; Linaje,M.; Preciado, J. C.; Sánchez-Figueroa F. “MVC Web design patterns and Rich Internet Applications.” Actas del IV Taller en SistemasHipermediaColaborativos y Adaptativos, asociado a JISBD’2007. Zaragoza, September 2007.Y. Fain, V, Rasputnis and A. Tartakovsky, Enterprise Development with Flex: Best Practices for FlexJupiter IT - JavaScriptMVC Training and SupportFuturescale, Inc. PureMVC framework, 2011. http://puremvc.org/Cairngorm DocsBorrowed contents from Calinlepure’s slide