Scripting Languages
Scripting Languages
1
Scripting Languages
Scripting languages are generally interpreted
instead of compiled.
Immediate execution allows for rapid development
and change.
Easy to learn and have support for high-level
structures and libraries.
Much of the initial work for many applications has
been done and is available in libraries.
Structures such as lists and dictionaries usually builtin
2
Scripting Languages
Python uses combination of compilation
and interpretation:
The source code is converted to an intermediate
form called byte code in a step similar to
compilation.
The byte code is executed by an interpreter.
This improves performance over purely
interpreted systems.
3
Source Source Source
Interpreter Compiler
Compiler
Interpreter
Run
Execution Execution
5
Extending
External programs can be used to increase
the functionality of the scripting language
by binding existing programs to it
This is called extending.
This allows function calls to be made
directly to the compiled programs instead of
through command interface (stdin/stdout)
6
Dynamic Typing
Scripting languages often support dynamic
typing.
The system manages the types of variables
without the programmers explicit input on
matters of length and type declarations.
Some languages treat all variables as strings
and modify them when non-string
operations occur with the variable.
7
Dynamic Typing
This can lead to type mismatches when a
variable is assigned a type that is not
expected.
It can also cause problems if a variable
name is misspelled.
Results in two different variables existing when
only one was intended.
8
Memory Management
Automatic memory management controls
the allocation and freeing (garbage
collection) of memory on demand.
Objects can grow and shrink as needed and are
removed when no longer necessary.
9
Object-Oriented
Many scripting languages are starting to
adopt object-oriented structures.
Traditional scripting languages tend to
become difficult to manage when used to
write larger programs and the inclusion of
OO is an attempt to address the problem.
E.g. Python, incrTCL, Object Oriented Perl
10
OO and Python
Python supports most OO concepts:
Ability to create multiple name spaces (scope).
Each object contains its own name space.
Polymorphism
Methods change based on their class.
Operator Overloading
Operators given multiple meanings.
Multiple Inheritance
A class can be the product of multiple parents.
11
Dynamic Code Creation
Many scripting languages can dynamically
create and execute code during the
execution of the script.
This generally cannot be done by a non-
scripting language.
a = 10
x = print a
exec(x)
12
R Language
R is a language and environment for
statistical computing and graphics. R
provides a wide variety of statistical (linear
and nonlinear modelling, classical statistical
tests, time-series analysis, classification,
clustering, ) and graphical techniques,
and is highly extensible.
13
Perl
Perl is a stable, cross platform programming language.
Though Perl is not officially an acronym but few people used it as Practical
Extraction and Report Language.
Perl takes the best features from other languages, such as C, awk, sed, sh, and
BASIC, among others.
Perls database integration interface DBI supports third-party databases
including Oracle, Sybase, Postgres, MySQL and others.
Perl works with HTML, XML, and other mark-up languages.
Perl supports Unicode.
Perl is Y2K compliant.
Perl supports both procedural and object-oriented programming.
Perl interfaces with external C/C++ libraries through XS or SWIG.
Perl is extensible. There are over 20,000 third party modules available from
the Comprehensive Perl Archive Network
14
Python
Much like Ruby, Python is known in part for its
readability. A popular web development
framework, Django, also makes Python a popular
choice for building web applications. Dropbox
was built with and still uses Python to run
much of its server-side code. Python can be used
for everything Ruby can. Whether you use Python
or Ruby depends on your skill set, the
communities youre exposed to, and your
development team.
15
Ruby
17
Glue language
Glue language refers to a programming language that is designed specifically
to write and manage program and code, which connects together different
software components.
Glue Language do not write the complete application in the language, but
rather, use the language to organize modules written in (possibly many
different) other languages, making them work together to form the application.
A glue language makes it easy to do that (convenient syntax, good support for
inter-process communication and data mugging, no compilation step etc).
Glue code, also called binding code, is custom-written programming that
connects incompatible software components.
Glue code can be written in the same language as the code it is connecting
together, but it is often written in a specialized interpreted scripting
language for connecting system components called a glue language.
18
Glue Language
Popular glue languages include
include AppleScript, JavaScript, Perl, PHP, Python, Ruby, VBScript and PowerShell
.
In addition to connecting disparate software modules, glue code can be used to tie
together multiple systems. If an organization runs cloud services on both Amazon
and Google, for example, glue code can be written to allow workloads and data
flow between the two companies' servers. Glue code is also useful for custom shell
commands, application wrappers and rapid application prototyping.
Glue code is sometimes looked upon as a necessary evil because it can easily
become the weakest link for service level agreements (SLAs) and, if not managed
properly, become excessively complicated spaghetti code that negatively affects
performance.
19
Frontend v/s Backend Development
The frontend of an application is distinctly human. Its what the user sees,
touches and experiences.
The technical skills required to be a frontend developer commonly
include:
HTML All code in a web application is eventually translated to
HTML. Its the language that web browsers understand and use to
display information to users.
CSS By itself, HTML is quite plain. HTML does provide some basic
style options, but to build a good frontend, developers must have
experience with CSS.
22
Disadvantages of Scripting Languages
The major disadvantage of scripting languages is that
executable code can inadvertently be downloaded from a
remote server to a web browser's machine, installed and
run using the local browser's interpreter. This is easily
done by visiting dubious web sites or downloading
programs without valid authenticity. The user is probably
unaware of anything devious occurring.
This is a weakness and major drawback in the formal rules
defining scripting languages like JavaScript and VBScript.
23