Вы находитесь на странице: 1из 6

A Fast and Flexible Framework of Scripting for Web Application

Development: A Preliminary Experience Report


Vincent Tam and W.K. Foo and R.K. Gupta
{vtam,foowanki,rakeshku) @comp.nus.edu.sg
Department of Computer Science
School of Computing, National University of Singapore
Lower Kent Ridge Road, Singapore 119260.
Abstract - The World-Wide Web represents an
opportunistic Internet-based platform on which many new
applications are developing rapidly. To facilitate fast Web
applications, scripting approach is one possible solution
for software developers. However, there are two major
drawbacks for many existing scripting tools. First, most
of these scripting tools are proprietary, and only available
on chosen platforms. Second, most scripting tools use the
Hyper-Text Markup Language (HTML) as the basis for
extension. To provide extra functionality such as database
connection, various extended codes or commands are
mixed with HTML tags to produce expected results.
However, this dirty approach will make the design and
development process more complicated.
In this paper, we proposed a systematic and flexible
scripting framework for fast Web application
development. The two major components, layout script
and information-processing script, naturally reflect the
static and dynamic properties of a Web application. In
addition, the information-processing script can flexibly be
split into different component scripts to suit different
applications. We built a prototype of a script parser and
an Integrated Development Environment (IDE) tool to
quickly develop an intelligent Web-based Personal
Computer Configuration Advisor. Clearly, our proposal
opens up many possible directions for investigation
including the uses of the IDE tool to develop other
applications, and the integration with other components to
handle more complicated Web applications.
Keywords : Innovative Web Applications, Web-Based
Information System Development, Scripting Tools.
I. INTRODUCTION
The World-Wide Web has been growing rapidly from its
original lbrm of a geographical information system to an
opportunistic Internet-based platform on which many new
devices or exciting computing technology[ 11are created
to facilitate complicated business activities such as stock
trading. In many real-life Web applications, there is
always a front-end engine to communicate with the users
while processing information from a large or distributed
database system running on a networking environment.
Clearly, to master all the programming skills required for
quickly developing Web applications, scripting approach
definitely provides a comfortable and high-level solution
to most developers since it frees the programmers from
the burden of learning low-level implementation details
for networking or database connectivity. Accordingly, we
witnessed the bloom of Web-based scripting languages or
tools such as the Netscape J avaScript [2] or the Microsoft
Active Server Page (ASP)[3] developed in recent years to
facilitate fast Web application development.
However, most of the existing scripting tools suffers from
two major drawbacks. First, these scripting tools are
proprietary and often bundled with their other proprietary
products for Web application development, for instance,
the Microsoft InterDev uses ASP as the basic language
for application development. Thus, these scripting tools
are highly restrictive and only available on certain
platforms. Second, most of these scripting tools take the
ad-hoc approach that they simply extend from the Hyper-
Text Markup Language (HTML) with extra functionality
such as form posting and processing as embedded codes
or specialized commands inside the HTML files for
preprocessing on Web servers or clients. Usually, after
preprocessing, the Web servers will generate a new set of
HTML files with their actual embedded codes loaded
from their proprietary packages or library files. As a
result, this extension approach only provides more
opportunity for the proprietary companies to propose
their own, possibly ad-hoc, extensions to create more
proprietary scripting languages or tools which are even
more confusing to the Web developers. More importantly,
this ad-hoc extension approach never provides a
satisfactory and systematic solution to complement the
fundamental deficiency of HTML which is originally
designed for solely specifying the static layouts of
documents on the Web. In other words, this dirty
approach of extending the HTML with vendor-specific
commands will simply make the design, development or
maintenance of Web applications more complicated.
450
0-7695-0577-5/00 $10.00 0 2000 IEEE
In this paper, we proposed a flexible and systematic
framework of highly simplified scripting approach for
fast Web application development. Instead of endlessly
extending the original HTML layer consisting of HTML
files, Web servers and clients with extra functionality, we
proposed a new 2-tier model in which the top layer
represents a higher level of abstraction for Web
application development. In this higher level of
abstraction, there are two major components, namely the
layout script and information-processing script, which
naturally reflect the static and dynamic properties of a
Web application. Ultimately, these two scripts will be
used to generate actual HTML files for further processing
in the bottom HTML layer. Clearly, this 2-tier,
component-based model represents a more systematic
approach for the design, development and maintenance of
general Web applications. To demonstrate the feasibility
of our proposal, we used the Practical Extraction and
Report Language (PERL) [4, 51 to build a platform-
independent prototype of our proposed scripting tools
which can help to quickly build an intelligent Web-based
application, the Personal Computer Configuration
Advisor. The empirical experience of using our scripting
framework to build such Web-based application is
encouraging. Furthermore, we developed these scripting
tools into an Integrated Development Environment (IDE)
tool to facilitate other Web application development.
Obviously, our work opens up many new directions for
future investigation including the uses of our IDE tool to
develop other applications, and the integration with other
components to handle complicated Web applications.
This paper is organised as follows. Section 2 reviews the
current related works on scripting approach for fast Web
application development, and our motivation for this
project. In Section 3, we detail the system design of our
proposed flexible scripting approach with easy integration
of other components to facilitate future extensions.
Section 4 describes the cross-platform prototype
implementation of our proposed scripting tools, written
mainly in PERL, with an example application of our
scripting tools to quickly build a Web-based PC
Configuration Advisor. Also, we briefly describe our IDE
tool based on our scripting approach to facilitate general
Web application development. Lastly, we conclude our
work in Section 5.
11. EXISTING SCRIPTING TOOLS FOR
WEB APPLICATION DEVELOPMENT
In this section, we will selectively review some of the
major existing scripting tools for Web application
development. As discussed in the previous section, most
existing scripting tools use some extended codes or
commands embedded inside the HTML files which
require preprocessing on the Web server or client to
"dynamically" generate the actual HTML pages. Thus,
depending on where the preprocessing and generation of
dynamic HTML pages are done, all existing scripting
tools for Web application development can be in general
classified into two categories, server-based or client-
based scripting approach. The majority of the existing
scripting tools is server-based. On the other hand, the
Netscape J avaScript allows preprocessing of the
J avaScript file to be done on the Web server or usually on
the Web browser running on the client side. We focus on
the uses of J avaScript as an example of client-based
scripting approach in our following discussion.
2.1 Server-Based Scripting Approach
In this subsection, we will focus on the server-based
scripting tools used in the Common Gateway Interface
(CGI) [4, 51architecture on which we built our prototype.
The CGI is an interface for running external programs,
namely gateways, to handle information requests from a
network client to an information server like a web server
running the Apache system.
Figure 2.1 shows how a gateway or CGI program
interacts with a web server and a web client in the overall
architecture. When a user sends an information request
from a web client to any specific web server running a
CGI program, the web server will pass the request to the
CGI program. The CGI program will then handle the
request and retrieve the appropriate document or generate
a document when necessary. Lastly, the resulting
ocument will be sent back to the web client.
Spnrer
Machlne B
Fiaure 2-1 : CGI -Web ClientlServer Interaction
45 1
In practice, CGI programs can be written in any language
provided that the resulting code is executable on the host
machine running the web server. However, in many
cases, programmers prefer to use scripting languages such
as PERL [5] to implement their CGI programs simply
because of the convenience to write and modify scripts.
Besides, to speed up the handling of CGI scripts in real-
life applications, there are some web servers which can
preload certain modules to execute the CGI scripts
instead of running another program to interpret and then
execute the scripts. An example is the Apache web server
with the modperl module to directly interpret PERL
based CGI script. In addition, the Microsoft Active Server
Pages and Visual InterDev are other examples of server-
based scripting tools.
2.2 Client-Based Scripting Approach
J avaScript [ 2] is a compact, object-oriented scripting
language for developing Web applications. One important
feature of J avaScript is its availability as both client-side
and server-side scripting language. In the following, we
will focus on the uses of J avaScript as client-side scripts.
As a client-side script, the J avaScript can be embedded in
a HTML page and then loaded into a Web-browsing
client such as the Netscape Navigator to interpret the
script during runtime. This is in contrast to the server-
based scripts which are preprocessed before the final
document is sent to the Web client. Therefore, client-side
J avaScript in general provides more dynamism as
compared to the other server-based scripting approaches
since it i!; more flexible to handle the users interaction
interactively on the client side.
111. THE SYSTEM DESIGN OF OUR
PROPOSED SCRIPTING APPROACH
As discussed in Section 1, most existing scripting
approaches, either server-based or client-based, simply
view the original HTML as basis to add in their required
functionality as vendor-specific extensions. Figure 3.1
shows this simple and ad-hoc extension model.
...............................................................................................
(Proprietary)
HTML Codes Extensions
.............................................................................................. i
FigIure 3-1 : 1-tier Ad-hoc Extension Model
for Existing Scripting Tools
Clearly, there are two major drawbacks for this ad-hoc
extension model. First, i t is unlikely that we infinitely
extend the existing scripting tools in this horizontal
manner when the Web applications become more
complex. Second, even though this. endless horizontal
extension is possible, the resulting scripting tools will
definitely be very difficult to maintain since all the
extensions can be ad-hocly created or randomly packed
together. Accordingly, we propose a more systematic 2-
tier, or in general hierarchical, model of scripting
approach to facilitate, possibly more complicated, Web
application development as follows.
Processing Scripts
script
Original Supported Parsers
HTML Codes Extensions
..............................................................................................
Figure 3-2 A Systematic 2-tier Model for
Proposed Scripting Tools
Clearly, our proposed 2-tier model for scripting tools is
more systematic as compared to the previous ad-hoc
extension model for existing scripting tools since, in
general, the more complex component(s) in upper layer
of our model is well organized to reflect the key
functionality of the general Web applications, and also
well supported by the components in the lower layer.
Accordingly, the layout script naturally represents the
static properties, mainly the page layout specification, of
a general Web application. On the other hand, the
information-processing scripts reflect the dynamic
behaviour of the Web application to process the forms or
data on the server or client side. As a whole, our
systematic approach will definitely facilitate the
development and maintenance of any Web application. In
addition, it should be noted that our proposed model i s
flexible since it allows the development of scripting tools
in both horizontal and vertical directions. To provide
more functionality to be supported in the base layer, it i s
possible to extend the scripting tools horizontally .
Besides, for developing more complicated Web
applications, i t is easy to split one layer in our original
model into two layers, or one components into two
components on the same layer to suit the real-life
applications. In Section IV, we are going to show how
our original 2-tier model can be adapted to build scripting
tools so as to facilitate the development of a common
I t should be noted that the horizontal extensions in our
model are definitely better designed and organized than
those possible in the previous ad-hoc extension model
since these extra components are often implemented to
support the higher-level components through bottom-up
or top-down approach.
452
class of rule-based Web applications as decision support
tools.
IV. PROTOTYPE IMPLEMENTATION OF
OUR SCRIPTING AND IDE TOOLS
In this section, we firstly discuss how to adapt the general
and flexible model presented in Section 111to facilitate
the development of a wide range of practical rule-based
Web applications. Based on this adapted model for
practical Web application development, we built the
prototype of our scripting tools in PERL. Then, we
demonstrate how to quickly build a Web-based PC
Configuration Advisor using our platform-independent
scripting tools. Our PC Configuration Advisor is an
example of Web-based decision support tools which are
rule-based, and frequently utilize information stored in
databases to draw useful conclusions to assist the decision
makers. Lastly, we describe an IDE tool based on our
scripting approach to widely support general Web
application development.
In the adapted 2-tier model, the original layout script is
split into two components, the miniscript and layout
script. The miniscript can be regarded as a very high-level
specification to link up and arrange the basic page layouts
as specified by the layout script to generate all the
required forms, ultimately as HTML files, for display on
any Web browser. Similarly, the information-processing
script is split into component and rule scripts to generate
a useful rule processor for each intelligent Web
application. The component script specifies the basic
components of useful information for manipulation, for
instance the form variables or selected records in
databases, while the rule scripts specifies the rules to
manipulate these basic components. It should be noted
that this approach also support the development of Web
applications which are not rule-based since we can simply
submit empty component and rule scripts to generate only
the necessary forms or pages for display on the Web
clients.
It should be noted that the emphasis of this paper mainly
focuses on our proposed framework of scripting.
Nevertheless, for complete description, Figure 4.1 shows
the Main section of the miniscript for developing the
Web-based PC Configuration Advisor, in which the
predefined variable page-layout is associated with the
provided layout template file layoutl .html. Clearly, the
syntax of the miniscripts is very simple.
; comment : Page name / Component Name is Main
[Main]
page-layout=layout 1 .html
; the page layout is associated the value layoutl .html
Fiqure 4-1 An Example Miniscriut
[component- 1 ]
type =radio
height =20
width =30
sql =select * from Table-A
Fiqure 4-2 A Sample Component Script
Figure 4.2 shows a part of the component script for
building the PC Configuration Advisor. It defines a new
component as a radio-button control occupying a display
area of 2Opixels x 30 pixels for users input. The choices
for the radio-buttons are directly read from all the fields
in the database named Table-A. For details about the
syntax of our designed scripting language, refer to [6].
When the remaining layout and rule scripts are provided,
our powerful set of parsers can automatically generate our
targeted Web-based PC Configuration Advisor as shown
in Fieure 4.3.
Fiqure 4-3 Our PC Confiquration Advisor
In general, our Web-based PC Configuration Advisor
supports rule-based information processing to actively
anticipate or validate users inputs, and also analyze
453
hardware information stored in databases to provide
useful advice on the best PC configurations for certain
usage subject to a user-defined budget limit, and a pre-
defined threshold limit used during the search[7].
Specially, we allows the active uses of rules, as stated in
the rule script to represent some domain experts
knowledge, to dynamically prune off options within the
same page (intra-page) or between the pages (inter-page).
For example, when the user selects the Type of PC to
be config,ured is Server on the first page, the option of
1 7-inch monitor will be automatically removed in the
last page with the active use of the domain experts rules.
Besides ensuring valid inputs from the users, it is mainly
used to remove irrelevant choices so as to facilitate the
search efficiency. After all possible pruning, an optimizer,
implemented as a easy-to-modify plug-in component
inside our PC Configuration Advisor, simply performs
exhaustive search during optimization of PC
configuriitions. Thus, for a users requirement like budget
I 3000 and threshold = 20, our Web-based PC
Configuration Advisor will definitely return only the first
20 optimal PC configurations with the total cost less than
$3000. I n case where no PC configuration can meet the
specified budget, an error message will be printed on the
resulting Web page.
In [6], we gave an empirical evaluation of our proposed
scripting to build the PC Configuration Advisor against
the conventional PERLKGI approach to construct the
same intelligent Web-based application. Under our very
conservative estimation, our approach took 62 man-hours
while the PERLKGI approach required 122 man-hours.
This can easily be explained as follows. Like most
scripting approach, we are in fact putting into more initial
efforts to develop these scripting tools so as to save the
later efforts for the subsequent application development.
For a comprehensive comparison of our proposal against
other approaches like ASP and J avaScript for developing
general Web applications, refer to [6]. As our empirical
evaluation result was very encouraging, we extended our
scripting tools to an IDE tool in order to facilitate the
other general Web application development. Inside our
IDE tools, we provide a Web Application Wizard to help
the users to quickly build a prototype for any Web
applicalion. In addition, our IDE tools provide a rule
editor, ;i component editor and related editors to facilitate
the fast modification of any required script for generating
new Web applications. At the moment, we are trying our
IDE tools to develop other Web-based applications.
* Technically, this special feature is achieved with
J avaScript through the uses of cookies to remember some
important values for each page.
IV. CONCLUSION
It is undeniable that many scripting tools exist for fast
Web application development. In this paper, we analyzed
that most existing scripting tools only support their
proprietary extension inside an ad-hoc and unstructured
model. More importantly, we proposed a systematic 2-tier
model of scripting approach for general Web application
development. And we showed how this original 2-tier
model can be adapted to build powerful scripting tools to
facilitate the development of a common class of Web
applications utilizing useful information stored in
database(s) to support decision making frequently
occurring in many important daily activities. Surprisingly,
we used our scripting tools to quickly build an intelligent
Web-based Personal Computer (PC) Configuration
Advisor. Empirical evaluation showed that our scripting
approach outperformed the conventional PERLKGI
approach, and possibly some existing proprietary
scripting tools as well, for this particular Web application
development. Furthermore, based on our scripting
approach, we developed an Integrated Development
Environment (IDE) tool to facilitate other general Web
application development.
Clearly, there are several interesting directions for our
future investigation. One obvious direction is to
experiment our IDE tools on other Web application
development to have a more comprehensive comparison
of our scripting approach against the embedded scripting
approach used by most existing scripting tools. Besides,
the improvement of the primitive search techniques used
in our optimizer should be interesting. Furthermore, the
addition of more useful functionality such as more
support for sophisticated database operations would
definitely make our scripting tools more attractive and
practical in real-life application development.
V. REFERENCES
[I ] Technology 2000 - Analysis & Forecast by Linda
Geppert and William Sweet, IEEE Spectrum,
J anuary Issue, pp, 27 - 56, IEEE Computer Society,
2000.
[2] The Specification of J avaScript by the J avaScript
Development Team at http://www.netscape.com.
[3] User Guides of Active Server Pages by Microsoft
Corporation, 1998.
[4] Discover PERL 5 by Naba Barkakati, IDG Books
Worldwide Inc., 1997.
[ 5 ] Programming in PERL by Larry Wall, OReilly,
1995.
454
[ 6] "A Flexible Approach for Developing Web-based
User Interface", Final-Year Project Report, School of
Computing, NUS, 2000.
[7] "Solving the PC Configuration Problems as
Constrained Optimization Problems", (to appear in)
PRICA1'2000, Melbourne, 2000.
455

Вам также может понравиться