Critical appraisal on distributed systems Server-side scripting and client-side scripting

rungabbyInternet και Εφαρμογές Web

10 Νοε 2013 (πριν από 3 χρόνια και 11 μήνες)

92 εμφανίσεις

Page
1

Student ID 80120599

Critical appraisal on distributed systems

Server
-
side scripting and client
-
side scripting


Abstract


Web technology continually improves and is constantly changing; the only thing that remains
constant is the client


server paradigm. The relationship betw
een a web client and a web
server are built around two major concepts that this paper will discuss: server
-
side scripting
and client
-
side scripting. Both types of scripting will be analyzed and critically discussed with
strengths and limitations highlighte
d. To demonstrate understanding over these major
concepts two specific applications will be analyzed. After this particular case is discussed a
comparison with other technologies will be made. The effects of scripting choice over web
server, operating syst
em, and hardware will be highlighted.


Introduction


Years ago web pages were plain and simple; no special effects combined with almost no user
interaction. Today most sites are in the continuous fight to earn visitors by impressing them
with special effec
ts and page customization. Most of these will be implemented using scripting
technology on either server or client side. The paper will discuss what capabilities (security,
scalability, portability, cross platform support, feature development) each of thes
e supports in
the context of server and client side scripting. We will learn about multiple scripting languages
(both server and client side) and analyze them one by one to understand when they should be
used. Basically the discussion will show how a web
-
d
istributed system can be implemented
using scripting languages. Since distributed systems support features like: client server
relationship, many users, resource sharing a platform independent character communication
between elements by message passing and

scalability, it is vital to analyze how scripting
languages support them. The second heading of this paper will analyze a particular case: the
JavaShop and DVDClub, two applications created to illustrate practical understanding over
server and client side

scripting technology. The last heading will go trough alternative scripting
technology for the JavaShop and DVDClub to compare advantages and disadvantages
(mentioned in the first heading) when using different technology for the same purpose. Each
major
scripting technology will be presented explaining its effect on web server, operating
system and hardware choices.

Page
2

Student ID 80120599

Evaluate

the
functionality

of client and server side scripting technologies for the
development and implementation of web based distributed
systems.


In past years web based distributed systems suffered great transformations as programming
languages evolved or were introduced onto the scene.
There is a wide possibility of choice
starting with more complex oriented object Java Server Pages (JSP
) and ending with intuitive
and easy to follow PHP or Python. Our attention will be laid upon the most commonly used
programming languages available, illustrating with them various capabilities of server and
client side scripting; eg: the difference betwee
n the two.


Both approaches (server and client side scripting) concern dynamically produced HTML
pages. Their execution time and placing determines the main difference between them. Whilst
server
-
side scripting uses a server’s resources (and if it’s not a
Java servlet it will have to be
loaded into memory and executed for each request), client
-
side scripting relies on the client’s
browser to do the work. From the start we will have to consider the environment that must
continuously be maintained by the web
server to run server
-
side script and plug
-
ins that are
required by browsers for the client side scripting. Before starting to argue about the behavior of
the two approaches, it is required to specify the scripting languages featured in this paper:




server
-
side scripting: PERL, JSP, ColdFusion, PHP, ASP



client
-
side scripting: JavaScript, VBScript, PerlScript


Server side scripting can require extra personnel to run
as
there must be a system
administrator maintaining services and enough processing power to su
pport a high number of
simultaneous connections. Additionally the host server must be able to support asp or php
scripted pages and which ever is applicable. The outputs from the script are HTML pages that
can be interpreted correctly by all existing brows
ers and providing no difficulties from the client
to view the data. Also these scripts directly interact with server files which are paramount for
the web site’s database. Script programmers will have to pay attention to possible bottlenecks
and to avoid t
hem. One such technique is to use client
-
side scripting. While the first type of
scripting relays on server’s power the second is executed locally on the client’s machine. If in
the first case the client had to wait for the server’s response (which could t
ake some time) in
Page
3

Student ID 80120599

the second case the result is instantaneous (after the script is downloaded). Basically client
-
side scripting offers increased user interaction and this is the reason why it is used for form
pre
-
processing (testing valid entries) whilst s
erver
-
side scripting is used for session handling,
login features, and database interaction. Client scripts cannot access files from the server
unless they interact with a server script. Figure 1 shows the relationship between user, server
and scripts (ser
ver or client side)



Figure 1


We can see from this diagram another difficulty (which sometimes can be severe) of client
-
side
scripting; browser dependency. Often JavaScript support is turned of in browsers because of
known security issues and this can c
ause client
-
side scripts not to run. But their usability is not
diminished since small web applications such as games will always rely on client’s machine.
Often users must install plug
-
ins for JavaScript, PerlScript or VBScript to run such scripts.
Server

side scripts on the other hand run on the server and are browser independent since all
of them can interpret HTML.


Page
4

Student ID 80120599

Figure 1 shows another connection between the two types of scripting; if they are used
together they can provide powerful and efficient so
lutions. This is because tasks can be
distributed to which ever side that can execute them most efficiently.


Let us consider a form validation script



If implemented on the server side, the user will have to execute multiple submits in the event of
an in
valid entry but, if implemented on client side all entries will be validated in real time and
only one submission will be necessary.


Another example would be a script that must connect to another server in order to retrieve
some data (eg: stock market va
lues or live games scores). There is a high possibility that the
user would not be able to access another server thus making a client
-
side script inefficient
whilst a server
-
side script is guaranteed to work and should be also secure thanks to the team
wor
king to maintain the system on the web
-
server! All languages support scalability and
portability as they can be executed across almost all platforms. However all of them do that in
a specific way and that is why in order to understand the advantages and di
sadvantages of
these two approaches, a short analysis of available technology is required.


JavaScript is the most used language for client
-
side scripting. This is because it was the first to
gain popularity and also due to the fact that it is natively sup
ported by the two main browsers
(Internet Explorer and Netscape). Core JavaScript Objects are: arrays, Boolean, date, function,
math, number and strings. The concepts that constitute the base of this language were drawn
from C/C++ and PERL. It is often use
d for shopping carts, data entry validation, mathematical
calculations and cursor, text/image animation.


VBScript is the second choice for client
-
side scripting on Windows platforms. Since it is a
language derived from Visual Basic it is easily embraced b
y VB and VBA developers. Both
JavaScript and VBScript support objects but neither support inheritance, therefore the first is
more object oriented. Other client
-
side scripting languages are PerlScript (through an ActiveX
interpreter), Tcl/Tk and REXX.


Page
5

Student ID 80120599

On
the server
-
side scripting many languages are trying to impose themselves predominantly
but none actually is successful in that goal. The main reason is the variety of server operating
systems and programming philosophies together with the various utility o
f server
-
side scripts;
eg for: password protection, browser sniffing/customization, form processing, and displaying or
modifying databases.


ASP (Active Server Page scripting) is a programming language developed by Microsoft, and
this is why it has a very
powerful ability. It can use COM objects and not forgetting also the
ADO (ActiveX data objects) feature that allows us to connect to almost everything that can be
turned into a database. This is extremely useful if we want to put data into documents (excel

spreadsheets or XML documents). Another advantage of the ASP programming language is
the fast and easy way dynamic contents can be created. The only issue with ASP seems to be
the lack of stability and security holes of IIS.


ColdFusion is a web applicati
on platform designed from zero. Because of this CFML
(ColdFusion Markup Language) can solve tasks even easier than ASP.























Page
6

Student ID 80120599

Consider the two code snippets:



























They both do the same thing but ColdFusion does it in a intuitive way and it is quite easy to
figure out what the <cfquery> or <cfoutput> tags stand for). Another interesting add
ition to
ColdFusion is the ability to create custom tags that give greater control over the application.
ColdFusion also benefits a well set up programming environment that provides proficient
debugging tools (breakpoints, watches).


JSP (Java Server Pages
) the scripting language from SUN utilizes servlets to create dynamic
content. All the programming power you get in JAVA is available in JSP (portability,
multithreading, extensive class libraries, object
-
oriented code, security measures). These
features m
ake JSP a scripting language that must be considered especially if the system
implemented is complex and requires sophisticated features.

<%


Set OBJdbConnection =


Server.CreateObject("ADODB.Connection")


OBJdbConnec
tion.Open "dvd.mdb"


SQLQuery = "Select * FROM admin"


Set rsadmin = OBJdbConnection.Execute(SQLQuery)


Do Until rsadmin.EOF


Response.Write (rsadmin("*"))


rsCustomers.MoveNext


Loop


%>


<cfquery name="dvddb" datasource="dvd.mdb">


select * from admin


</cfquery>



<cfoutput query="dvddb">#*#</cfoutput>


Page
7

Student ID 80120599

PERL (practical extraction and report language) is by far the most exhaustive scripting
language when it comes to stri
ng manipulation. This scripting choice is activated through
mod_perl with Apache web server. PERL supports objects and some other special data types.
Another advantage of this scripting language is that is totally free.


At the end of this short presentati
on stands PHP the free programming language that can be
ported to both UNIX and Windows Operating systems. It is based on C, JAVA and PERL thus
giving it the object
-
oriented edge as well. Many developers that have knowledge of other
programming languages f
ind it easy to start coding in PHP because of the similarities and the
fact that PHP is easy to learn (objects and methods are straightforward: Request.QueryString,
Request.Form or Request.Cookie).


Compare a JavaScript scripted online shop/shopping cart
against an ASP and backend
database scripted alternative.


Whil
st

the above paragraphs focus on the discussion about the advantages and disadvantages
of server and client side scripting, along with a short description of the languages available, the
follow
ing paragraph will illustrate these advantages and disadvantages with the help of a
JavaScript shopping cart and ASP driven site example.


The first difference we notice between the two implementations is the login feature. The ASP
website will require log
in information helping the server to customize the HTML pages served
to the client. Conversely the JavaScript shopping cart will display the same content to all
clients. The ASP website is featured with an admin section allowing live data manipulation
whil
e the JavaScript shopping cart can only hold data for the current session only. (using
cookies which are small pieces of temporarily stored data).


Another difference occurs at the form validation time. Whilst the ASP website requires data
retrieval from t
he client creating two time gaps (one when the data is posted and the second
while the answer is sent back) the JavaScript shopping cart form validation is executed
interactively. Both of the implementations can support payment, but it is highly recommende
d
Page
8

Student ID 80120599

that these transactions to be held on secure https servers. The JavaScript will require a third
party server for these transactions.


Compare both with any alternative and supporting scripting technologies of DHTML,
XML, PHP and CGI explaining the enhan
cements these would also provide and how
they would integrate with examples


Alternatives for the ASP and JavaScript are relatively easy to find. The first question in
searching for an alternative is what operating system the server will use? If it is a Wi
ndows
platform we are restricted to choosing between ASP, PHP and ColdFusion and if it is Linux
then we can choose between JSP, PERL and PHP. Even though PERL and PHP are ported
for windows platforms as well their stability is somewhat questionable. On the

client
-
side
scripting JavaScript is the right choice since it is natively supported by both IE and Netscape
and also supported by UNIX/LINUX X browsers. If the website is visited by millions of visitors a
proper database software must be selected.


Curre
ntly an Access DB is being used for the asp application, but a very good alternative is
MySQL (both for Windows and Linux). The hardware also becomes a problem in this case. eg:
serving millions of users at the same time requires high processing power and
leverage on
clients processing power (client
-
side scripts). Bandwidth must also be considered. The HTTP
server (currently IIS) can be switched to Apache because of it’s known stability and the fact
that it can run both in Windows and Linux. Because ASP can

easily be substituted with PHP or
PERL a reliable free alternative is PHP/PERL with Apache HTTP server and a MySQL
database running alongside the use of JavaScript. Therefore whilst this alternative has many
advantages (eg: free and stable) there may be a

problem with the coders, since they are
harder to find and since the probability that current employees (ASP developers) will be
comfortable with PHP or PERL in depth is low.









Page
9

Student ID 80120599

Conclusion


Server and client side scripting provides us with some great

tools for creating dynamic content
sites. Thus using them separately may seem a good solution. A better solution is to use them
together if it is possible. Future implementations will consist of combined ASP/PHP/PERL/JSP
with JavaScript and with a ASP/PHP
/PERL/JSP solution. The script will detect if the visitor’s
browser has the capability of client
-
side scripting and if so it will use it, otherwise the server
-
side scripting only solution will be used. Concluding, the choice over a scripting language is
in
fluenced by the operating system platform used. In extreme cases special hardware
implementations must be used (clustering) but this will affect the proficiency of the web site
rather the choice of a scripting language.


References


1.
http://hotwired.lycos.com/webmonkey/99/46/index1a.html?tw=programming
, “Server Side Scripting Shootout”,
(
21 May 2001
)


2.
http://www
-
106.ibm.com/developerworks/linux/library/l
-
script
-
survey/
, “Choosing the right server
-
side scripting
language”, Craig McElwee,
(
1 May 2000
)


3.
http://www.informit.com/isapi/product_id~{1B5462E7
-
4EAA
-
4320
-
813A
-
1B1B1E94518A}/st~{3CED3F7A
-
C960
-
4BE5
-
A064
-
FDB360FC8DD8}/sessio
n_id~{2DDB5EFB
-
89AA
-
4D6F
-
BFE2
-
4C946B90E8F3}/content/articlex.asp
,
“Language Choices for Client
-
side scripting” Scott Loban,
(
30 Nov 2001
)


4.
http://www
-
106.ibm.com/developerw
orks/linux/library/wa
-
sssl.html
, “Server Side scripting”, Erik Zoltan,
(
1 April
2001
)


5.
http://www.thescripts.com/serversidescripting/
, “Server Side Scripting Tutorials”


6.
http://www.websiteowner.info/articles/cgi/whichside.asp
,

“Client Side or Server Side?”


7.
http://asptechniques.com/content.asp?a=c
o&cID=949
, “Client vs Server side validation”