Syracuse University SURFACE

Electrical Engineering and Computer Science College of Engineering and Computer Science

2004

Building Desktop Applications with Web Service in a Message- based MVC Paradigm”, to appear

Xiaohong Qiu Syracuse University, Electrical Engineering and Computer Science Department ; Indiana University, Community Grid Labs, [email protected]

Follow this and additional works at: https://surface.syr.edu/eecs

Part of the Computer Sciences Commons

Recommended Citation Qiu, Xiaohong, "Building Desktop Applications with Web Service in a Message-based MVC Paradigm”, to appear" (2004). Electrical Engineering and Computer Science. 63. https://surface.syr.edu/eecs/63

This Article is brought to you for free and open access by the College of Engineering and Computer Science at SURFACE. It has been accepted for inclusion in Electrical Engineering and Computer Science by an authorized administrator of SURFACE. For more information, please contact [email protected]. Building Desktop Applications with Web Services in a Message-based MVC Paradigm

Xiaohong Qiu1, 2

1EECS Department, Syracuse University 2Community Grids Lab, Indiana University 501 Morton N. St, Suite 224, Bloomington, IN 47404, U.S.A [email protected]

Abstract interface partially specified by the portlet Over the past decade, classic client side standard. applications with Model-View-Controller (MVC) architecture haven’t changed much but become We have a general approach of building Web more complex. In this paper, we present an applications centered around messages. The key approach of building desktop applications with challenge is to exploit this concept in design and Web Services in an explicit message-based MVC implementation to provide scalable interoperable paradigm. By integrating with our systems. Specifically we investigate a universal publish/subscribe messaging middleware, it modular design with messaging linkage service makes SVG browser (a Microsoft PowerPoint model that converge desktop applications, Web like client application) with Web Service style applications, and Internet collaboration to interfaces universally accessible from different achieve reusability, scalability, interoperability client platforms ─ Windows, Linux, MacOS, and pervasive accessibility. We have PalmOS and other customized ones. systematically carried out our work by proposing Performance data suggests that this scheme of an “explicit message-based MVC” paradigm building application around messages is a (MMVC) as the general architecture for Web practical architecture for the next generation applications [2]; presenting an approach of Web application client. building “collaboration as a Web Service” by decomposition of MMVC in a three-stage Keywords pipeline architecture for three collaboration types Message, MVC, Web service, SVG and ─ monolithic, thin client and interactive client publish/subscribe [3]; bridging the gap between desktop and Web application by leveraging the existing desktop 1. Introduction application Web Services are becoming an increasingly with a Web R F I O ce Facing our Port important feature of Internet and Grid systems. service Res Web Service They support a loosely coupled service oriented interface Application or Model architecture that builds on previous distributed rt through User Facing Po object architectures like CORBA, Java RMI, and “MMVC in a Input port Output port WSRP COM to provide scalable interoperable systems. publish/subscr Portal and Aggregate WS User Facing fragments JSR168 The broad applicability of this approach includes ibe scheme”, Por tlets enterprise software, e-Science and e-Business. which is the View Correspondingly there are a growing number of focus of this View powerful tools that are available for building, paper; maintaining and accessing Web Service-based identifying phone systems. These tools include portals that allow desktop handheld some key Figure1 Portlet Approach to Web Services and user frontends to Web Services. This model for issues that their user interfaces user interaction has new standards like portlets influence message-based Web applications with with WSRP (Web Services for Remote Portlets) a detailed analysis of performance in a and the Java Specification Request JSR168 presentational style application experiment with supporting lightweight interfaces to the backend rich Web content and high client interactivity [4]. resources. This architecture shown in fig.1 Elsewhere we discuss SIMD and MIMD implements the Model-View-Controller or MVC collaboration as the general architecture of [1] architecture with a clean message based “collaboration as a Web service” model [5].

1 Control W3C Document Object Model (DOM) [8] defines “a platform- and language-neutral interface that allows programs and scripts to dynamically access and update the content, View Model Display structure and style of documents” and a generic 2a Conventional MVC paradigm event model, which implemented by version 5 browsers (e.g. Mozilla and Internet Explorer). t Control Su en b v sc I e ri U b DOM can reflect structure of Meta data h e U lis I b g ev u in Pu e P er b nt d li abstracted by XML schema. DOM also allows en sh e r re ib n cr de s ri b ng Model any language bindings; therefore it can be used Su View by variety of applications. Scalable Vector 2b Explicit message-based Publish/Subscribe MVC model Graphics (SVG) [9], as defined by W3C, is “a Figure 2 MVC in Publish/Subscribe language for describing two-dimensional The general MVC approach of fig. 2a) is a well- graphics and graphical applications in XML”. established paradigm, which has been used for SVG is an example of DOM application. many years. As we describe later in more detail, Compared with HTML content, SVG has richer traditional MVC applications employ method- web graphics flavor with additional features based interactions between the components with inherited from XML and DOM which makes it a this approach giving the needed high unique technology that has been widely used by performance for interactive applications. In this graphical authoring tools, GIS system and data paper, we explore “explicit message-based visualization. SVG browser is a MVC” (MMVC) ─ a different approach with stand-alone client application, which is written in MVC being used systematically but with Java apart from a few native classes; there are message based interactions (shown in fig. 2b), also customized SVG implementations for between the model and the view components. handheld devices. We suggest that modern computers and networks are fast enough that this approach will give 3 Message-based MVC and SVG adequate performance for desktop applications 3.1 Introduction such as those in the Microsoft Office Suite. We We choose an existing system ─ Batik SVG embody this idea as the “MVC rule of the browser [7], and modify its architecture from a Millisecond” [6]. This asserts that message based method-based desktop application to a message- interactions between “nearby” components have based one. This has several implications. The an intrinsic delay of a few milliseconds and so message-based architecture allows one to build this linkage approach is possible whenever such desktop applications as web services and so a delay is acceptable. Simple non-optimized Java unify traditional desktop and web service plus messaging gives such a delay whenever the portal approaches. This unification makes components are either on the same computer or collaborative applications straightforward to on machines with a local area connection. build as described in section 4. Further the separation of model and view makes it easier to In this paper, we explore this area and make two support diverse client devices and operating contributions. Firstly we look at existing systems. This could be significant with the method-based MVC application – the Batik SVG growing interest in PDA and Linux clients. Note browser from Apache [7] – and convert it into a our strategy allows “long distance” linkage message-based approach as contrasted in figures between the “model” (business logic of 2a) and 2b). We discuss some of the issues that application) and view as well as their came up in this conversion. Secondly we use this cooperation on local networks as within a message-based version of SVG to explore the campus. However transcontinental latencies are overhead in the message-based approach. We hundreds to thousands of milliseconds and so find it represents about a 20% overhead for this cannot be used for interactive experience. As “model’ and “view” distributed in different sites we describe later, we will use the same on Indiana University’s Bloomington campus messaging infrastructure that has been used to and the user does not distinguish the interactive support large Grid applications. This unification experience in switching from method to of Grid and client applications into a single message-based interactions. message-based architecture is key to our paper. We can use our approach for interactive 2. Technology Background: DOM and SVG applications when model and view are nearby

2 and allow collaboration and traditional Web separately developed and provides a variety of portal use for remote access. publish/subscribe models including peer-to-peer Our first goal is a complete analysis of the and Java Message Service (JMS) emulation. Our structure and interaction between components of use for collaborative SVG would exploit these a real client application. Batik SVG browser is latter Grid messaging capabilities of an Apache open source project that implements NaradaBrokering. The changes bring up issues SVG specification version 1.0. Such experience that cause a challenge to the system: has general significance as it helps us in ƒ Timing becomes a compelling issue with the understanding of similar commercial tools such separation of client and Web Service server, as Microsoft PowerPoint, Adobe Illustrator and original assumption and design principle break PhotoShop, Draw, and Macromedia Flash, since time scope drastically increases from tens which have proprietary implementations. of microsecond level (e.g. a Java method call) Secondly, our approach allows building to a few milliseconds level (network latency collaborative SVG as a special case of our plus system overhead). general Collaboration as Web Service ƒ Object serialization is a must have toolkit ─ architecture. This work has been discussed in our messages, as a linkage vehicle, contains earlier papers in Internet Computing 2003 [2] component information from both sides and and SVG Open 2003 [3]. We presented a keep context same. Synchronization is a factor multiplayer chess game as a test case of our to consider for context consistency. collaborative SVG infrastructure without decomposition of the client application. 3.2 Message-based Event model Thirdly, we discuss the conversion of a client The basic idea is illustrated in fig. 3. Traditional application into a distributed system and identify event-based programming is used extensively in the difference in design principles. This approach the Batik SVG browser and most modern allows maximum reusability of existing applications. Different parts of a program are components in Web application deployment and linked asynchronously with one part producing also unifies desktop and Web applications events that are passed to listeners whose callback architecture in a message-based service model. method has been passed to the producer. As MVC is a frequently used paradigm in modern shown in fig. 3b) this can also be implemented architecture design (e.g. ). In with explicit messages where listeners subscribe a “conventional” MVC, “controller” executes its register call back method A B tasks through method calls since messages are invoke call back method hidden in system level. We make a critical with event 3a) method based observation, namely “conventional” MVC has to ) ic op (t ss be replaced by an “explicit message-based” la c nt Su ve Broker b e to s MVC in order to enable components of the n e cr a ve ib p n e t u ss t e la cl application to be distributed. In our approach, we S c as t S s en e ev nd n e use “explicit control messages” to abstract the a v h en lis t A ub B semantic meanings of “controller” so that p messages of the original system are exposed and 3b) message based pulled into application level. Such abstraction Figure 3 Message or method based Publish/Subscribe generates structural changes as the following: to an event class (topic) and events producers publish them to this topic. Our strategy is to a) Original client application is physically split replace the listener model of fig. 3a) by the into client user interface (“view”) and core publish/subscribe broker model of fig. 3b). Note functional component (“model”). The latter that either approach can use explicit queues naturally becomes a Web Service on server side. (maintained on a broker in the message case) or b) Method calls, which play the role as alternatively integrate the broker into the “controller” in a client application, are taken producer as in most simple method-based event over by “explicit control messages” that models. One can use this strategy in several parts communicate between client interface and Web of the SVG browser and in doing so produce Service server through network. multiple web services coordinated in a single c) Our approach requires us to support our model application; there are natural event linkages view linkage with a high performance messaging between the client user interface and the GVT middleware infrastructure. We use (or Graphic Vector Toolkit, an internal module NaradaBrokering [10], which has been to represent graphical view of DOM) tree used in

3 ApplicationApplication (JavaScript)(JavaScript) Batik; performance will continue to improve while another SVGSVG DOMDOM networks will also continue to increase in between Events as messages Rendering as messages bandwidth with however latency for long GVT and GVTGVT distance linkage remaining higher than that the DOM RendererRenderer needed for interactive use. Thus inevitable tree and infrastructure improvements will tend to make Messages contain control information finally Figure 4 SVG browser derived from message-based MVC our approach more attractive in the future. These that ideas can also suggest a uniform approach to between the DOM and the Java or JavaScript user interface design with desktop and web application. After substantial experimentation, applications sharing a common portlet (WSRP, we chose to split the SVG browser between the JSR168)-based architecture. DOM and GVT tree. The resultant MMVC architecture is shown in figure 4. This choice has This could motivate the development of new the advantage that it naturally generalizes to desktop applications with many capabilities not other DOM applications. However we made for present in today’s systems such as OpenOffice more pragmatic reasons, as other choices and Microsoft Office. Other research in our appeared to require more restructuring of the laboratory is looking at extending our ideas to existing software. OpenOffice while a limited implementation is possible using the rather crude event interface 4. Performance exposed for PowerPoint. These ideas can unify We have started an extensive series of PDA and desktop, as well as Linux, MacOS, performance measurements to demonstrate the Windows and PalmOS applications. viability of our approach. The main issues are the algorithmic change from breaking the code into References two and the two-way transit time is only 20% of 1) G. Lee, Object oriented GUI application the total processing time in the case of local development. Prentice Hall, 1994. ISBN: 0- brokers. We separately measured the overhead in 13-363086-2. NaradaBrokering itself which consisting of 2) Xiaohong Qiu et. al. Internet Collaboration forming message objects, serialization and using the W3C Document Object Model in network transit time with four hops. This Proceedings of the 2003 International overhead is 5-15 milliseconds depending on the Conference on Internet Computing, Las operating mode of the Broker in simple stand- Vegas June 2003. alone measurements. The contribution of 3) Xiaohong Qiu et. al. Collaborative SVG as NaradaBrokering to the overhead is larger than A Web Service in Proceedings of SVG Open, this (about 30 milliseconds in preliminary Vancouver, Canada, July 2003. measurements) due to thread scheduling 4) Xiaohong Qiu, Shrideep Pallickara, and overhead interfacing with the complex SVG Ahmet Uyar Making SVG a Web Service in application. We will discuss this and a Message-based MVC Architecture optimizations to the system performance in submitted manuscript for SVG Open future papers [4]. Conferences, Tokyo, Japan, September 2004. 5) Xiaohong Qiu and Anumit Jooloor, 5. Conclusions Message-based Web Services Architecture We believe our prototype shows how a message- for e-Learning to appear in International based MVC (three-stage pipeline) model can Conference on Education and Information generate a powerful application paradigm Systems: Technologies and Applications, suitable for SVG and other presentation style Orlando, Florida, July 2004. applications. As SVG is an application of the 6) Geoffrey C. Fox, Software Development W3C DOM, we can generalize the approach for around a Millisecond in CISE Magazine. other W3C or similar DOM based applications. 7) Apache Batik SVG Toolkit. Our approach suggests that one need not develop 8) W3C Document Object Model (DOM) special “collaborative” applications. Rather any Level 2 Core Specification. application developed as a Web service can be 9) W3C Scalable (SVG) made collaborative using the tools and version 1.0 Specification. architectural principles discussed in this paper. 10) Community Grids Lab NaradaBrokering Note that Moore’s law implies that computer system.

4