---- ====== General Purpose Scripting Languages ====== ---- ==== Introduction & Overview ==== * History of, rationale for development and use of dynamic, interpreted (scripting) languages * General characteristics of dynamic languages * Advantages / disadvantages of dynamic languages * Application of dynamic languages ===== "Scripting" Languages or Technologies ===== * Some current open source languages and technologies * Perl * Python * PHP * Ruby * JavaScript * Lua * Significant market demand for "Scripting" language skills ===== History and Rationale ===== * Display [[https://wikiless.tiekoetter.com/wiki/Computer_terminal|terminals]] running interactive shells developed in the 1960-70s * Examples: [[http://www.columbia.edu/cu/computinghistory/2260.html|IBM 2260]], [[http://www.columbia.edu/cu/computinghistory/h2000.html|Hazeltine 2000]], [[http://www.columbia.edu/cu/computinghistory/vt52.html|DEC VT52]] * Led to demand for scripts to relieve human operators of tedious, repetitive typing of commands * Led to shell scripting languages and DOS batch files * Eventually, general programming language features were added: * variables and structures (loops, conditionals) * The REXX scripting language started out as a scripting language on IBM mainframes. * [[https://cssegit.monmouth.edu/jchung/cs371/blob/master/examples/d.cmd|Sample REXX code]] (written around 1995) * Certain applications made scripting languages available to allow the creation of extensions and macros * emacs and its use of Lisp * Microsoft Office applications and their use of Visual Basic for Applications ===== History and Rationale (text processing) ===== * Processing text-based records one of the oldest uses of scripting languages * Led to development of several standard UNIX tools: awk, sed, grep * Perl was developed initially to address limitations in the standard text processing UNIX tools. * //Regular expressions// are an important part of the text processing tasks performed by scripting languages. ===== History and Rationale ===== * The growth of the World Wide Web (//server-side scripting//) * Demand for dynamic (non-static) content * Led to the Common Gateway Interface (CGI) being provided by web servers, e.g. Apache * CGI programs required heavy text parsing, and dynamic languages like Perl were suited to that task * CGI had limitations (slow, needing to launch a new process for each Web request) * Led to different approaches to dynamic content delivery (Web scripting) * mod_perl, mod_python, ASP, PHP, JSP, Zope (Python), Ruby on Rails * Modern web browsers typically provide scripting languages to allow scripting of dynamic-type behaviors on web pages * ECMAScript (JavaScript), CSS and increasingly in HTML itself (HTML 5) * AJAX (use of JavaScript and XML to increase responsiveness of Web apps) ===== General Purpose Dynamic Languages ===== * Also called [[http://wikiless.tiekoetter.com/wiki/Dynamic_programming_language|"dynamic programming languages"]] * Languages that start as scripting languages can gain enough general programming features that they become suitable for general application development * Perl, Tcl, Lua * Some are developed from scratch with general usage in mind. * Python, Ruby * Still are often called "scripting languages" ===== Typical Characteristics ===== (of dynamic programming languages, including "scripting" languages) * Interpreted, rather than compiled * i.e., not directly executed but interpreted line-by-line by a language interpreter program which dynamically translates the instructions into machine-executable instructions "on the fly" * means that programs written in dynamic languages will execute much more slowly than compiled languages like C/C++ or more slowly than intermediate (byte-code compiled) languages like Java/C# * limits their use for very large applications * Though large applications are still written in dynamic languages, especially in Python * including media players, games, bittorrent clients * Components of or plug-ins to large applications are written in scripting languages. ===== Typical Characteristics (dynamic typing) ===== * Dynamically or "weakly" typed * vs. statically or "strongly" typed (typical of compiled languages) * Introduce variables or data structures as needed without the need to "declare" variables * Variables start with generic type, often string * "Everything is a string." applies to some scripting languages. * Shell scripting languages like bash, Tcl, Perl * "Everything is an object." applies to other scripting languages. * Python, Ruby ===== Advantages/Disadvantages ===== (claimed) * Allow accomplishing relatively simple tasks with a smaller amount of code * Larger projects can be completed in a shorter amount of time * vs. compiled language * Assuming same programmer aptitude * Increased "programmer productivity" * Changes to code are quicker to test * Code is smaller, easier to understand * Execution is slow, requires greater CPU/memory overhead * Lack of strong typing can lead to unforeseen errors, errors which strong typing protects against ----