Unit 3
Unit 3
Traditional scripting
Modern Scripting
Traditional scripting
The activities of traditional scripting include
System Administration:
Automating everyday tasks, building data reduction tools, and controlling systems remotely.
System administrators often use scripts to automate tasks such as adding new users or
backing up file systems. Shell scripts, sequences of shell commands executed from a file,
serve this purpose well.
Experimental Programming:
Scripting languages are ideal for 'experimental programming,' where requirements are
unclear at the outset, and multiple iterations are needed.
They allow quick experimentation without the overhead of traditional edit-compile-link-load
cycles.
Scripting languages help create command-line interfaces for applications based on C libraries,
enabling users to automate and control applications effectively.
Server-Side Scripting:
Handling web forms and other server-side tasks using CGI (Common Gateway Interface).
Application Automation:
Remote control of applications, often requiring conditional logic to handle different stages of
interaction. This capability evolved from controlling dial-up links to modern remote application
automation.
Enhancing system and application capabilities through scripting. For example, early desktop
applications allowed users to automate sequences of operations using macros, which evolved
into sophisticated scripting capabilities like those in Visual Basic for Applications (VBA).
Text Manipulation:
o Specialized scripting languages like AWK and Perl are used for processing and manipulating
textual data. They integrate capabilities for text manipulation with system command
execution, making them powerful tools for system administrators and developers.
Modern Scripting
Modern scripting languages often incorporate object-oriented principles and are used in more
advanced and varied contexts:
Visual Scripting:
Constructing graphical interfaces using visual objects like controls in Visual Basic or widgets
in Tcl/Tk and Perl-Tk. These objects respond to events such as mouse clicks, and the
response actions are defined by scripts.
Visual scripting is used to create new applications or to develop visual interfaces for existing
applications, often as prototypes.
Scriptable Components:
Modern applications are built around the concept of scriptable components, which expose
interfaces conforming to a scripting architecture.
Components may include visual elements, parts of compound documents, or more substantial
functional objects like spellcheckers or database interfaces.
Enhancing web pages with client-side scripts (e.g., JavaScript) for dynamic interaction and
server-side scripts for backend processing.
WEB SCRIPTING
The web is one of the most fertile areas for the application of scripting languages today.
Web scripting can be divided into three main areas:
o Processing web forms
o Creating pages with enhanced visual effects and user interaction
o Generating pages dynamically from material held in a database
From the early days of the web, HTML has allowed a basic form of user interaction through
the use of forms. These forms are defined by HTML tags within a document. In the original
implementation, when a user submits a form, the information entered is encoded and sent to
the server, where it is processed by a CGI (Common Gateway Interface) script. This script
eventually generates an HTML page that is sent back to the browser.
Data Encoding and Decoding: When a form is submitted, the data needs to be encoded in a
way that the server can understand. CGI scripts on the server decode this data to process it.
Text Manipulation: Creating the HTML response page often involves extensive text
manipulation.
System Access: The script might need to run other processes or establish network
connections to gather or process the required information.
Given these requirements, Perl has become the language of choice for CGI scripting due to
its text manipulation capabilities and handling of untrusted data.
For more immediate feedback, some form processing can be done on the client side using
languages like JavaScript or VBScript. This client-side validation can check the form data
before it is sent to the server, improving the user experience by catching errors early.
Dynamic web pages provide enhanced visual effects and user interactions.
This is achieved through scripting languages that interact with the Document Object Model
(DOM) of the webpage.
The DOM represents all elements of a webpage (like headings, emphasized text, tables, and
form components) as scriptable objects.
Another significant use of web scripting is the generation of HTML content dynamically on the
server. This approach is particularly useful for creating pages that draw content from a database.
Common implementations include:
Server-Side Scripting: Languages like PHP, ASP (Active Server Pages), and JSP
(JavaServer Pages) generate HTML dynamically based on the data retrieved from
databases.
Database Integration: This allows for the creation of dynamic content that can change
based on user inputs, database updates, or other factors.
For example, Microsoft's IIS Web server supports Active Server Pages (ASP), which allows
embedding scripts written in JScript or VBScript within HTML pages. This facilitates the
creation of dynamic and data-driven web pages.
UNIVERSE OF SCRIPTING LANGUAGES
The world of scripting languages is vast and multifaceted, comprising various overlapping
domains each with its unique applications and characteristics.
These domains can be broadly categorized into traditional scripting, modern scripting, and
web scripting, each forming integral parts of what we might call the "scripting universe."
This universe includes several overlapping worlds:
The scripting universe continues to expand with new and innovative applications:
1. Enterprise-Level Implementations
o Examples: Tcl has been used to develop robust manufacturing systems, while Perl
has been employed to implement enterprise-wide document management systems for
large aerospace companies.
o Advantages: The significant increase in processor power in recent years has
mitigated the performance concerns traditionally associated with scripting languages.
This allows organizations to leverage the order-of-magnitude increase in productivity
that scripting languages offer, resulting in faster development cycles and more
flexible solutions.
2. Increased Productivity and Efficiency
o Modern Context: The ease of use and rapid development capabilities of scripting
languages make them ideal for prototyping, automating complex workflows, and
building interactive applications quickly and efficiently.
o Performance Considerations: With modern hardware, the performance overhead of
scripting languages is often negligible compared to the productivity gains they
provide. This shift has made scripting languages an attractive option for a wide range
of applications beyond their traditional uses.