Chapter 1: Server-side Introduction

mewstennisΛογισμικό & κατασκευή λογ/κού

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

63 εμφανίσεις

Chapter 1: Server-side Introduction 1
ID: 288-EE | Version: 14 | Date: 1/22/08 2:34:41 PM
Chapter 1: Server-side Introduction
Chapter Index
What is Server-side Development?

Client-side Examples

Server-side Examples

Client-side Advantages

Server-Side Advantages

Working Together
Client/Server Systems

Client Attributes

Server Attributes

Client/Server Examples

Client/Server System Tiers

n-Tier Architecture
What is Server-side Development?
Server-side development is the process of creating applications which run principally on a 'server', rather
than on the end-users 'client' computer. Perhaps the easiest way of understanding this concept is to view the
following diagram and considering some examples:
7.daisy:296-EE (Server-Side Introduction: Client/Server Systems)
Chapter 1: Server-side Introduction 2
ID: 288-EE | Version: 14 | Date: 1/22/08 2:34:41 PM
Client-side Examples

Executables - These .exe files (assuming Windows) run entirely on the user's own PC, whether they
are Word Processors, windows applications, games or small programs. While they may have been
previously downloaded from the internet they are run on the client side, using the PC as a host for
processing, memory and storage.
 Applets - Java applets are small programs designed to run within another program. They prove very
useful in the contex of the web for the reason that the moment that their bytecode is downloaded, they
can be executed quickly within the web browser. Again, while they may have been downloaded, or
indeed may have continuous communication with other clients/servers (ie. synchronous chat servers)
they are still executed on the client side using the client computer's resources.
 Javascript - JavaScript is an object oriented-based interpreted scripting language that is embedded
into HTML pages. With it you can control and program elements of your own web pages on the
client-side without depending on server-side scripts etc. Using JavaScript you can design your own
windows, create forms, perform mathematical calculations, and connect to existing applets and plug-
ins. JavaScript is an interpreted language, which means that all that is needed is a JavaScript-enabled
browser, which interprets and executes and JavaScript code as the HTML file is loaded. Again, this is
a client-side technology since the code is executed from within your browser, which is running on the
local machine.
Chapter 1: Server-side Introduction 3
ID: 288-EE | Version: 14 | Date: 1/22/08 2:34:41 PM
Server-side Examples
 CGI Scripts - The Common Gateway Interface, normally referred to as CGI, was the first server-
side scripting language to be developed. These CGI applications are executed remotely, on the server
and the resulting output is returned to the client through a browser. Virtually all processing (with the
exception of the client browser, rendering the output into a viewable form) occurs on the server side
and simply the output is returned to the client. Even though a CGI program can be written in almost any
language, the Perl programming language has become the predominant choice. Many web servers such
as Apache enable CGI through dynamically loaded modules.
 PHP - Hypertext Preprocessor (PHP) is an open source, cross-platform and free scripting language
which has a fairly large developer base. It has been around for quite some time now and like CGI has
a number of disadvantages when compared to the servlet/JSP architectures, which will be dealt with in
the next Chapter.
 Servlets/JSPs - A considerable section of this course centers around the concept of Java servlets and
JSPs which are written entirely in Java and provide arguably the best solution for server-side scripting
today. They run entirely on the server-side on a servlet or JSP container, embedded in a web server or
application server. These are dealt with in detail in the following chapter.
Client-side Advantages

Server Resources - Each client uses its own resources to execute the code on the webpage, hence
saving resources for the provider. This is inherently the disadvantage with server-side scripting, where
the server must use valuable resources to parse each page it sends out, possibly slowing down the web
Server-side Advantages
 Code Protection - Because the server side code is executed before the HTML is sent to the browser,
your code is hidden.
 Browser Independent - Server-side code is browser independent. Because the HTML code returned by
your browser is simple HTML, you do not need to worry about the version of browser, javascript etc.
that the client is using.
 Local Access - Server-side code is the only choice if you want to access files and directories on the
server machine. Client-side languages such as JavaScript are unable to provide this functionality for
security reasons.

Application Updates - By operating on the server-side updating to new versions, fixing bugs,
implementing code patches become a simple process of updating the server machine. Consider in
opposition to this, a windows application running on the client - in order to update or make fixes, the
client must download the latest version each time.
Working Together
Web sites can be designed to take advantage of the strengths and weaknesses of both client-side and server-
side. For example: Company A might wish to register users before they can access their site and provides
an online form for this purpose. The obvious server-side element occurs after the information is submitted,
where the customer details are processed into a file or saved in a database. However, client-side scripting
such as JavaScript might be useful to validate the form before the details are submitted and this is performed
from within the user's browser. This can be freqently seen throughout the web, where phone numbers, valid
credit card numbers, dates of birth etc. are validated at the form stage before submission.
Chapter 1: Server-side Introduction 4
ID: 288-EE | Version: 14 | Date: 1/22/08 2:34:41 PM
Many developers in the past would have argued against the use of any significant level of client processing.
For example, JavaScript can be disabled in browsers; does this cause your web-site to cease to function? Is
the client using a mobile phone? does their phone browser even have JavaScript capability? JavaScript was
also known for its cross-browser incompatibility problems; would your web application function correctly
on every brand and version of client browser? There are other alternatives; why not just use server-side
validation for form fields?
In recent times (since 2005) there has been a revitalisation in the use of JavaScript (and Client/Server
cooperation in general) due to technologies such as AJAX (Asynchronous JavaScript and XML) which is
used for creating interactive web applications. We will introduce Ajax at a later stage in the module.
This module concentrates on the development of web facilities which are focused on the "server", rather
than the client. This is not to say that the client is ignored - it is through a combination of client and server
development that web-based applications are created. However, in the module only the basics of client
development are covered, whereas a number of chapters cover the development based at the server end. So
while the module obtained it's name from the majority of content, when we develop web-based systems we
are really talking about Client/Server Systems.
Next: Chapter 1 - Client/Server Systems
Previous: Server-Side Development: Notes Index
13.daisy:296-EE (Server-Side Introduction: Client/Server Systems)
14.daisy:297-EE (Notes Index)