Scripting in Multi Tier Architecture

Introduction: Scripting languages have come a long way. From adding client side interaction, publishing live and dynamic data to web site and an ability to communicate with components in application server is making them a very important in building multitier architecture for organizations. During recent years improvements and ability to do server side scripting is further validating their importance in a multitier architecture.

They are mostly used in following types of application:

1) Datawarehousing. Plays a major role in publishing data out to web

2) Internet and Intranet Applications. eg Fed Ex.

3) Applications where deployment is major pain and has lot of remote users.

How do they fit in Multitier Architecture

wpe1.jpg (76694 bytes)

In the above architecture web server act as a page server, which consist of templates and scripts. Clients which are written in html and scripts, calls these server side script and these scripts then query against the database and generates dynamic data in html format using existing templates. ASP(Active Server Pages by Microsoft) is one of the popular deployment environment which provide these functionalities. ASP also provides way to communicate between scripts and allow them to talk to components  resides in component or transaction server. More vendors are pushing for application server which contain page server as well as transaction and component server, thus give users more integrated environment for development of the above architecture. Sybase EAS 3.0 is another examples which allows you to build objects or components in 4GL tool and then move them to application server where they can be acessed by page server. Microsoft Interdev in combinatin of ASP and MTS is another example of such a product. You can use this tool to build your dynamic pages as well as create activex components.

Decision in creating your application using scripting languages deployment structure or using 4GL tools.(VB or ASP)

wpe2.jpg (21228 bytes)

Major vendors selling application platform  in deployment of scripting languages in multitier architecture.

wpe4.jpg (19515 bytes)

Comments about some of these vendors:

Power Dynamo Allows you to write client and server side Scripts in Javascript, Jscript, VbScript, dynamoscript.It also allows you to deploy your application in Active server pages, Netscape Livewire. Whereas ASP allows you to write Jscript, VBScript and its best if you deploy this with IIS server and NT environment.(Microsoft centric).

Vendor Links:

Microsoft Interdev and ASP

Sybase Enterprise Application server(power dynamo and jaguar CTS server)
In EAS 3.0, power dynamo is a part of application server 3.0 which contain JaguarCTS and power dynamo)

Power dynamo is an application server, that extends webserver functionlaty. It has open, scalable, multithreaded architecture. It has following capabilities.

Stores and manages web resources in databases
Retrieves Web Resources from databases
Dynamically generates Web pages from web resources and data

To develop content for the web server Power site is provided.

Power site is an integrated development environment that streamlines the development of dynamic web sites requiring databases, client- and server side programming, application servers and components. Power site support management of complex development projects, team of developers using various web development technologies, and large collection of different types of web resources

Pros for using Sybase Solution:

  1. Its an open environment with the flexibility of using ASP deployment meaning using Microsoft Jscript and VBScript. It allows us to access any component model, from CORBA, EJB to custome power builder objects.
  2. New version of Power dynamo(EAS 3.0) promises to deliver on XML , instead of writing script in above scripting languages allows you to write in pure Java, native drivers support for only sybase database, integration with Jaguar CTS, and integrate Mail SMTP support.( Netscape Live wire (Javascript) environment supports native drivers, ASP only supports ODBC for now).
  3. It does support datawindow and stored procedure, which will allow us to move to a new architecture faster than others.

Silver Stream

Cold fusion

SERVER SIDE SCRIPTING   in terms of ASP.

Server-side scripting is scripting done on the server. Well, that's the easy definition. It enables you to run scripts on the server rather than on the client machine. This works well for information that can be stored in a central place (like a database). With server-side scripting, you can enable visitors to your site to have personalized views of the content you offer. The script on the server can conditionally show or not show content that the user has requested, based on information kept in a database on the server.

To implement server-side scripting, you use Active Server Pages (ASP). ASP technology is built directly into Microsoft Web servers. It is supported on Windows NT® running Internet Information Services (IIS) 3.0, Windows NT Workstation 4.0 running Peer Web Services, and Windows® 95 Personal Web Server. If you want to use Active Server Pages with either Personal Web Server on Windows 95 or Peer Web Services on Windows NT Workstation 4.0, you must install the Active Server Pages components after installing your server software. T

To use server-side scripting, create a file with an ASP extension, for example, filename.asp. The file may contain any combination of HTML, scripting (such as VBScript or JScript), and calls to components (ActiveX controls or Java applets written by yourself or bought off the shelf). ASP files on the server can be updated at any time. Simply save the changes to the file and the script will be automatically compiled the next time the Web page is loaded.

ASP includes five standard objects for global use:

Request -- To get information from the user
Response -- To send information to the user
Server -- To control the Internet Information Server
Session -- To store information about and change settings for the user's current Web-server session
Application -- To share application-level information and control settings for the lifetime of the application

Like scripting in HTML, which uses <!-- and --> as delimiters, ASP uses delimiters too. ASP uses <% and %> to enclose script commands. The scripting languages supported by ASP include VBScript and JScript and enable you to provide some real logic to the HTML code that your ASP script sends to the browser. The following example (from the troubleshooting techniques provided by the IIS team) demonstrates how ASP can be used with VBScript to process a logon request:

 

Example:

<%@ LANGUAGE="VBSCRIPT" %>
<!-- FILE: login.asp -->
<HTML>
<HEAD>
<TITLE>Login Example</TITLE>
</HEAD>
<BODY>

<% IF IsEmpty(Request.Form("Name")) THEN
 Response.Write "Please enter your Name"
%>
 <FORM ACTION="login.asp" METHOD=POST>
  <INPUT NAME="Name"
  TYPE=TEXTBOX MAXLENGTH=20>
 <INPUT TYPE="SUBMIT" VALUE="Submit">
 </FORM>
<%
 ELSE
'User verification code goes here Response.Write "Welcome " & Request.Form("Name") & "!"
END IF
%>

</BODY>
</HTML>

 

Popular Scripting languages.

(FROM WEB TECHNIQUE ARTICLE)

Client-Side Choices

Client-side scripting involves embedding blocks of script into your existing HTML files. The server doesn't treat the script any differently from other tags in your file, but the browser interprets them on the user's computer.

Writing client-side script offers some distinct advantages, but there are a few penalties for using it, as well. The most attractive reason to use client-side script is that you don't need a special server, and the scripts don't load your server -- the processing occurs at the Web browser. The downside? When you send a browser some script, you're assuming that the browser will understand it. And of course, your code is visible to any user smart enough to open the HTML source, too.

JavaScript. Although JavaScript is understood by Microsoft Internet Explorer and Netscape Navigator, there are subtle differences between the implementations. Still, many scripts will work on both platforms. The European Computer Manufacturers Association (ECMA; see www.ecma.ch) arrived at a standard for JavaScript in 1997, so it's likely that implementations will converge on this standard over time. Netscape recently announced support for JavaScript 1.3 (see developer.netscape.com/docs/manuals/communicator/jsref/js13.html).

VBScript. Even though it's similar to JavaScript, VBScript uses a Visual Basic-like syntax. While many casual programmers are more comfortable using Basic instead of Java. For more details please check VBScript in detail

Server-Side Choices

Server-side scripting involves using scripts on the server. Of course, this loads the server since it must process the script each time someone requests a page. Also, you have to have special permissions to use server-side scripting. Many Web authors don't have easy access to their server's scripting facility. The good news is that your script runs entirely on the server, so you know what you can do and what software is available. If your script outputs well-formed HTML, any browser can read it.

CGI. The classic way to perform server-side functions is via Common Gateway Interface (CGI). Many CGI programs use Perl, a scripting language well-suited to the task. However, you can write CGI programs in practically any language including C++, Python, and Java. Without careful planning, CGI can introduce security holes in your server, and CGI programs are usually hard to debug and difficult for casual programmers to write.

Server-Side Java, JavaScript, and VBScript. Microsoft's IIS server can interpret Java, JavaScript, and VBScript on the server (there's also a third-party program that will interpret Perl script, at www.activestate.com). This is much simpler to manage than CGI, and, if your server supports it, is a great way to script. Netscape servers support Java and server-side JavaScript. You can read more about server-side scripting, and how it integrates with other Web technologies, in my book, Active Server Pages Black Book (Coriolis).

PHP. If your server doesn't support server-side Java or VBScript, it might work with PHP, an Open-Source scripting language especially popular on the Apache Web server. You can find out more about PHP at www.php.net.

Miva. Formerly known as HTMLScript, this is similar to PHP, but is a commercial offering (see www.miva.com).

Servlets. Servlets are an increasingly popular way to write Java objects that extend the server. The object-oriented nature of Java makes it easy to write servlets, and they're often more efficient than CGI or similar solutions.

ISAPI, NSAPI, and Native Server APIs. Most major Web servers provide ways to integrate code more tightly with the server via a low-level API. This is generally feasible only for hard-core programmers who have full access to the server.