0% found this document useful (0 votes)
142 views12 pages

SL Unit I

This document provides an introduction to scripting languages. It defines what scripts and scripting are, discusses the origins and current uses of scripting, and describes different types of scripting languages. Specifically, it defines scripts as programs written in a scripting language to automate tasks. It explains that scripting languages are interpreted rather than compiled and are often used to customize and automate existing systems. The document also distinguishes between server-side and client-side scripting languages based on where the code is run.

Uploaded by

Poorna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
142 views12 pages

SL Unit I

This document provides an introduction to scripting languages. It defines what scripts and scripting are, discusses the origins and current uses of scripting, and describes different types of scripting languages. Specifically, it defines scripts as programs written in a scripting language to automate tasks. It explains that scripting languages are interpreted rather than compiled and are often used to customize and automate existing systems. The document also distinguishes between server-side and client-side scripting languages based on where the code is run.

Uploaded by

Poorna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

UNIT – I

Introduction to Scripting Language: Scripts and Programs, Origin of Scripting, Scripting


Today, Characteristics of Scripting Languages, Uses for Scripting Languages, Web Scripting,
and the universe of Scripting Languages.

Introduction to Scripting Language


What is Scripting?
• A script is a program that consists of a sequence of statements.
• It is written by using the syntax or commands of a scripting language or interpreted
language.
• It is embedded in an HTML web page, interpreted, and executed by a certain scripting
engine.
• Script is written for various intentions such as automating the processes on a local
computer or to create a web page on the web.
• The programming language in which script is written is called scripting language or
simply script language.
• Programs in scripting languages are often written to facilitate the enhanced features of
websites.
• Generally, scripting languages are not compiled (like C++, Java or other languages)
but are interpreted by an interpreter at runtime.
• A scripting language allows programs to be accessed and utilized by other programs,
with many modern apps and computer functions.
• However, users can also interact directly with scripted programs in many ways,
including by inputting direct commands, clicking buttons, and so forth.

Coding vs Scripting
• Coding refers to the use of any computer language to compose instructions for
computers, the programs they run, or both.

• Scripting is a type of coding that automates various step-by-step functions or


processes. Otherwise, these instructions would need to be input individually by a
developer.
What are Scripting Languages?
• "A scripting language is a type of programming language which does not require
explicit compilation step, and it is designed for a runtime system to automate the
execution of tasks”.

• It executes tasks within a special run-time environment by an interpreter instead of a


compiler.

• They are usually short, fast, and interpreted from source code or bytecode. Such
environments include software applications, web pages, and even embedded systems
in operating system shells and games.

• A scripting is designed for integrating and communicating with other programming


languages.

• Scripting languages support "script," which is small program written for a specific
runtime environment. These are interpreted at runtime rather than compiled.

• It means, to convert the source code to machine code, scripting languages use an
interpreter, not the compiler.

• The scripting language refers to dynamic high-level, general-purpose interpreted


languages such as Python, Perl, etc.

• Thus, a scripting language can automate different environments such as application


softwares, webpages, text editors, operating system shells, computer games, etc.

Scripting languages, on other hand, address different problems:


Building applications from ‘off the shelf’ components
Controlling applications that have a programmable interface
Writing programs where speed of development is more important than run-time
efficiency.
Types of Scripting Languages
There are two main types of scripting languages: server-side and client-side. They
differ on where the code is run from, which affects not only the actual languages chosen but
also the performance and their capabilities.

Server-side scripting language


The term server-side scripting language refers to those that run off a web server. Since
it performs from the back-end side, the script is not visible to the visitor. Because of that, it is
a more secure approach. They are often used to create dynamic websites and platforms,
handle user queries, and generate and provide data and others. Examples: PHP, Python,
Node.js, Perl, and Ruby.
Client-side scripting language
Client-side scripting languages run off the user’s browser. It is usually performed at
the front end, which makes it visible to visitors and makes it less vulnerable to exploits and
leaks. As such, it is often used to build user interfaces and lighter functionality such as that.
Since it runs locally, they usually provide better performance and, therefore, do not strain
your server. Examples: HTML, CSS, jQuery, and JavaScript.

Scripts and programs


• Definition: A programming language is a computer language which is used to
communicate with computers using a set of instructions.
A scripting language is a type of programming language that supports scripts,
which are small programs mainly used to automate the execution of a specific
function in a specific runtime environment.
• Interpretation: Programming languages use compiler and do not require to be
interpreted by another language or application; hence these languages run
independently and do not depend on the parent program.
In contrast, scripting languages are interpreted within another program; for
example, JavaScript has to be combined within HTML, then interpreted by the web
browser.

• Design: Programming languages are specifically designed to facilitate the developer


with complete code and software development, whereas scripting languages are
specifically designed to make programming faster and simpler.

• Development: Development of software/Application or coding using programming


languages is difficult as lots of lines of code is needed for a task. Whereas in scripting
languages, coding is easier as it needs only a few lines of code to perform a task.

• Speed: The programming languages are faster in speed because of using a compiler,
which usually runs faster as it finds all the errors at once after analysing the program.
In contrast, Scripting languages are slow as they use an interpreter that analyses a
program line by line. Every time it detects an error, it stops further execution until the
error gets removed.

• Examples: Examples of programming languages are C, C++, Java, Scala, COBOL,


etc.
Examples of Scripting languages are Perl, Python, JavaScript, PHP, Ruby, etc.

Origin of Scripting
• The use of the word ‘script’ in a computing context dates back to the early
1970s,when the originators of the UNIX operating system create the term ‘shell
script’ for sequence of commands that were to be read from a file and follow in
sequence as if they had been typed in at the keyboard

• The name ‘script ‘ being used for a text file that was intended to be executed directly
rather than being compiled to a different form of file prior to execution.

• Other early occurrences of the term ‘script’ can be found. For example, in a DOS-
based system, use of a dial-up connection to a remote system required a
communication package that used proprietary language to write scripts to automate
the sequence of operations required to establish a connection to a remote system.

• However, scripts only become interesting when they have the added value that comes
from using programming concepts such as loops and branches.

Scripting today
SCRIPTING IS USED WITH 3 DIFFRENT MEANINGS:

1. A new style of programming which allows applications to be developed much faster than
traditional methods allow, and makes it possible for applications to evolve rapidly to meet
changing user requirements.

This style of programming frequently uses a scripting language to interconnect ‘off


the shelf’ components that are themselves written in conventional language. Applications
built in this way are called ‘glue applications’, and the language is called a ‘glue language’.

A glue language is a programming language (usually an interpreted scripting language)


that is designed or suited for writing glue code – code to connect software components. They
are especially useful for writing and maintaining:
• Custom commands for a command shell
• Smaller programs than those that are better implemented in a compiled language
• "Wrapper" programs for executable, like a batch file that moves or manipulates files
and does other things with the operating system before or after running an application
like a word processor, spread sheet, data base, assembler, compiler, etc.
• Scripts that may change
• Rapid prototypes of a solution eventually implemented in another, usually compiled,
language.

Glue language examples:


AppleScript m4 Scheme
ColdFusion Perl Tcl
DCL PHP Unix Shell scripts (ksh,
Embeddable Common Lisp Pure csh,bash, sh and others)
ecl Python VBScript
Erlang Rebol Work Flow Language
JCL Rexx Windows PowerShell
JScript and JavaScript Ruby XSLT
Lua

2. Using a scripting language to ‘manipulate, customize and automate the facilities of an


existing system’, as the ECMAScript definition puts it. Here the script is used to control an
application that provides a programmable interface: this may be an API, though more
commonly the application is constructed from a collection of objects whose properties and
methods are exposed to the scripting language. Example: use of Visual Basic for applications
to control the applications in the Microsoft Office Suite.

3. Using a scripting language with its rich functionality and ease of use as an alternate to
a conventional language for general programming tasks, particularly system programming
and administration. Examples: UNIX system administrators for a long time used scripting
languages for system maintenance tasks, and administrators of WINDOWS NT systems are
adopting a scripting language, PERL for their work.

Characteristics of Scripting Language


➢ A scripting language is usually interpreted from source code or bytecode.

➢ Scripting languages may be designed for use by end users of a program – end-user
development – or may be only for internal use by developers, so they can write
portions of the program in the scripting language.

➢ Scripting languages typically use abstraction, a form of information hiding, to spare


users the details of internal variable types, data storage, and memory management.

➢ Scripts are often created or modified by the person executing them, but they are also
often distributed, such as when large portions of games are written in a scripting
language.

➢ The characteristics of ease of use, particularly the lack of an explicit compile-link-


load sequence, are sometimes taken as the sole definition of a scripting language.

Integrated compile and run: SL’s are usually characterized as interpreted languages, but
this is just an over simplification. They operate on an immediate execution, without need to
issue separate command to compile the program and then to run the resulting object file, and
without the need to link extensive libraries into the object code. This is done automatically. A
few SL’S are indeed implemented as strict interpreters.
Low overheads and ease of use:
1. Variables can be declared by use
2. The number of different data types is usually limited
3. Everything is string by context it will be converted as number (vice versa)
4. Number of data structures is limited (arrays)

Enhanced functionality: SL’s usually have enhanced functionality in some areas. For
example, most languages provide string manipulation based on the use of regular expressions,
while other languages provide easy access to low-level operating system facilities, or to the
API, or object exported by an application.

Efficiency is not an issue: Ease of use is achieved at the expense of efficiency, because
efficiency is not an issue in the applications for which SL’S are designed.
Some of the prominent characteristics of scripting language are as follows:
• It is open-source, which means a user can have full control to view and edit it.
• It is easy to learn and work with.
• Comparatively faster to develop than an actual program.
• It has a limited number of data structures which makes it easy to write and edit.
• The language is beneficial to bring interactivity in web pages.
• It helps in creating new applications in web browsers.
• It is used to create plug-ins and extensions.

Advantages
• It is an easy and quick process to learn coding in Scripting language, and for this,
much knowledge of web technology is not needed.

• In scripting languages, a wide variety of libraries is available that enable the


developers to develop new applications.

• With the help of scripting languages, we can add visualization interfaces and
combinations to web pages. Most of the latest web pages need scripting languages for
creating enhanced web pages, fascinating UI, and many more.

• There is less number of data structures and variable to be used, which make it highly
efficient.

• These are less code-intensive as compared to traditional programming languages.

Disadvantages
• The main disadvantage of scripting languages is that they are slower than compiled
languages or programming languages because the interpreter in scripting languages
read and analyse each statement line by line during the execution.
• Every time the interpreter detects an error during the execution of program, it stops
further execution until the error gets taken away.

Uses of Scripting Languages


Modern applications of scripting languages are:

1. Visual scripting: A collection of visual objects are used to construct a graphical interface.
This process of constructing a graphical interface is known as visual scripting.

The properties of visual objects include text on button, background and foreground
colours. These properties of objects can be changed by writing program in a suitable
language.
The outstanding visual scripting system is visual basic. It is used to develop new
applications. Visual scripting is also used to create enhanced web pages.

2. Scripting components: In scripting languages we use the idea to control the scriptable
objects belonging to scripting architecture.

Microsoft's visual basic and excel are the first applications that used the concept of
scriptable objects. To support all the applications of Microsoft the concept of scriptable
objects was developed.

3. Web scripting: web scripting is classified into three forms. They are processing forms,
dynamic web pages, dynamically generating HTML.

Application areas: Four main usage areas for scripting languages:


1. Command scripting languages
2. Application scripting languages
3. Mark-up language
4. Universal scripting languages

1. Command scripting languages:


➢ These are the oldest class of scripting languages.
➢ They appeared in 1960, when a need for programs and tasks control arises.
➢ The most known language from the first generation of such languages is JCL (Job
Control Language), created for IBM OS/360 operating system.
➢ Modern examples of such languages include shell language, text-processing
languages, such as sed and awk.
➢ These languages were one of the first to directly include support for regular
expression matching - a feature that later was included into more general-purpose
languages, such as Perl.

2. Application scripting languages:


➢ Application scripting languages were developed in 1980s, in the era of personal
computers, when important applications such as spread sheets and database clients
were introduced, and interactive session in front of the PC became the norm.

➢ One of the prime examples of these languages is Microsoft-created Visual Basic


language, and especially its subset named Visual Basic for Applications, designed
explicitly for office applications programming

3. Markup languages:

➢ Markup languages are a special case in the sense that they are not a real programming
languages, but rather a set of special command words called ’tags’ used to mark up
parts of text documents, that are later used by special programs called processors, to
do all kinds of transformations to the text, such as displaying it in a browser, or
converting it to some other data format.

➢ The basic idea of markup languages is the separation of contents and structure, and
also including formatting commands and interactive objects into the documents.

➢ The first markup language named GML (Generic Markup Language) was created in
1969 by IBM.

➢ In 1986, ISO created a standard called SGML, based on GML ideas.

4. Universal scripting languages:


➢ The languages that belong to this class are perhaps the most well-known. The term
“scripting languages” is associated with them.

➢ Most of these languages were originally created for the Unix environment.
➢ The Perl programming language was made for report generation, which is even
reflected in its name (Practical Extraction and Report Language).

➢ It is commonly said that the primary reason for it’s enormous popularity is the ability
to write simple and efficient CGI scripts for forming dynamic web pages with this
language.

➢ The Python language was originally made as a tool for accessing system services of
the experimental operating system Amoeba.

➢ Later it became a universal object-oriented scripting language. Implementations exist


for the Java Virtual Machine and also for Microsoft Intermediate Language used on
Microsoft .NET platform.

➢ Unlike Perl and Python, which make it easy to write completely standalone programs,
Tcl relies heavily on C and C++ extension modules.

Web scripting
➢ The process of creating and embedding scripts in a web page is known as web-
scripting.

➢ A script or a computer-script is a list of commands that are embedded in a web-page


normally and are interpreted and executed by a certain program or scripting engine.

➢ Web scripting is used to create dynamic content that allows for user interaction with a
web page.

➢ Scripts may be written for a variety of purposes such as for automating processes on a
local-computer or to generate web pages.

➢ The programming languages in which scripts are written are called scripting language,
there are many scripting languages available today.

➢ Common scripting languages are VBScript, JavaScript, ASP, PHP, PERL, JSP etc.
Types of Scripts
There are two distinct varieties of scripts, namely:
• Client-Side Scripts
• Server-Side Scripts
Client-Side Scripts
• Interaction within a web page can be enabled through the use of client-side scripting.
• Downloading of the client-side scripts occurs at the client's end, after which the
browser is responsible for interpreting and running the scripts.
• The scripting that runs on the client side is dependent on the browser. To put that
another way, the client-side browser needs to have scripting enabled before scripts
can be run.
• When client-side interaction is used, client-side scripting is what's needed to make it
work.
• Examples of possible applications for client-side scripting are as follows:
o To obtain information from the screen or browser of the user.
o Online games.
o Modifying the way pages look in the browser without having to reload the
page itself; for example, rolling your mouse over a hyperlink will highlight
that link without having to reload the page.
• VBScript, JavaScript, and jQuery are three languages that are frequently used for
client-side scripting.

Server-Side Scripts
• Using server-side scripting, you are able to finish or carry out a task on the server and

then send the result to the client. This is a two-way process.

• Because the server is the one doing all of the work in server-side scripting, it does not
matter which browser is being used on the client end of the connection.

• When the information is sent to a server to be processed at the server end, the
scripting that runs on the server is called server-side scripting.

• Examples of possible applications for server-side scripting are as follows:


o Password protection
o Browser customization or information transmission based on the needs of the
client-side browser
o Form processing
o Building and displaying pages created from a data base
o Dynamically editing, changing, or adding content to a web page
• PHP, ASP.NET, Node.js, and Python are just a few examples of well-known server-
side scripting languages.
Web is the most fertile areas for the application of scripting languages. Web scripting divides
into three areas
1. Processing forms
2. Creating pages with enhanced visual effects and user interaction
3. Generating pages ’on the fly’ from material held in database.

Processing Web forms:


In the original implementation of the web, when the form is submitted for processing,
the information entered by the user is encoded and sent to the server for processing by a CGI
script that generates an HTML page to be sent back to the Web browser.

This processing requires string manipulation to construct the HTML page that
constitutes the replay, and may also require system access, to run other processes and to
establish network connections. Perl is also a language that uses CGI scripting.

Alternatively for processing the form with script running on the server it is possible to
do some client –side processing within the browser to validate form data before sending it to
the server by using JavaScript, VBScript etc.

Dynamic Web pages:


‘Dynamic HTML’ makes every component of a Web page (headings, anchors, tables
etc.) a scriptable object. This makes it possible to provide simple interaction with the user
using scripts written in JavaScript/Jscript or VBScript, which are interpreted by the browser.

Microsoft’s ActiveX technology allows the creation of pages with more elaborate user
interaction by using embedded visual objects called ActiveX controls. These controls are
scriptable objects, and can in fact be scripted in a variety of languages. This can be scripted
by using Perl scripting engine.

Dynamically generated HTML:


Another form of dynamic Web page is one in which some or the entire HTML is
generated by scripts executed on the server. A common application of the technique is to
construct pages whose content is retrieved from a database. For example, Microsoft’s IIS web
server implements Active Server Pages (ASP), which incorporate scripts in Jscript or
VBScript.

The universe of scripting languages:


Scripting can be traditional or modern scripting, and Web scripting forms an
important part of modern scripting. Scripting universe contains multiple overlapping worlds:
• The original UNIX world of traditional scripting using Perl and Tcl
• The Microsoft world of Visual Basic and Active controls
• The world of VBA for scripting compound documents
• The world of client-side and server-side Web scripting.
The overlap is complex, for example web scripting can be done in VBScript,
JavaScript/Jscript, Perl or Tcl. This universe has been enlarged as Perl and Tcl are used to
implement complex applications for large organizations e.g: Tcl has been used to develop a
major banking system, and Perl has been used to implement an enterprise-wide document
management system for a leading aerospace company.

You might also like