Scripting Languages Intro
Download
Report
Transcript Scripting Languages Intro
Scripting Languages Intro
Jan Stelovsky, ICS 215
Wikipedia
• A scripting language, script language or extension
language is a programming language that allows
control of one or more software applications.
• "Scripts" are distinct from the core code of the
application, as they are usually written in a different
language and are often created or at least modified by
the end-user.
• Scripts are often interpreted from source code or
bytecode, whereas the applications they control are
traditionally compiled to native machine code.
• Scripting languages are nearly always embedded in the
applications they control.
Comment
• from stackoverflow:
– You will notice the use of "usually", "often",
"traditionally" and "nearly always" - these all tell
you that there is no set of distinct attributes that
make a specific language a "scripting language".
Scripting vs. “Programming”
Languages
• Scripting languages are Programming languages (PL)
• interpreted vs. compiled
– slow vs. fast
• but: Java – a PL is hybrid
– compiled to bytecode
• bytecode is common to all hardware platforms
• bytecode is then interpreted
– JIT even compiles to “native” code dynamically
• but: LISP – a PL - is interpreted
• but: scripting languages became hybrid/compiled
– all JavaScript scripts are nowadays compiled
Hybrid Processing
program
script
bytecode
native
Windows
Intel
native
Mac
Intel/Motorola
native
Linux
Intel
Scripting vs. “Programming”
Languages cont.
• scripting languages often operate other programs,
or the operating system (OS), e.g. Windows, or
other applications, e.g. the browser
– batch “shells” on Unix
– Applescript operating other applications
• but often programs in PL can execute or at least
create scripts for scripting languages
• but does JavaScript “operate another program”
– the browser?
Other Aspects
• verbose vs. terse
– PL are typically terse, vs. Applescript
• but
– but most languages adopted C syntax: C, C++, Java,
JavaScript, even Ruby
Other Uses of Scripting Languages
• CoffeeScript is a better JavaScript
– classes: inheritance
• consistency
• alleviates JavaScript quirks
– == and ===
– is variable defined?
– what’s variable’s type
• needs to be translated to JavaScript
PL Charts
• How did PLs develop
– typical chart
– http://upload.wikimedia.org/wikipedia/commons/a/a7/TaxonomyofProgrammingLanguages.png
• mostly C as “grandfather”
• Java = C++--
– consider trends (innovation, density)
• book publishers, e.g. O’Reilly
– http://oreilly.com/news/graphics/prog_lang_poster.pdf
Traditional PL Chart (top)
Traditional PL Chart (bottom)
O’Reilly PLs & Books
O’Reilly PLs
Most Recent O’Reilly PL Books
• 8 out of 13 newer PLs (=60%)
• Note: JavaScript ~= ECMA Script ~= ActionScript
215, ICS and PLs Popularity
ICS 215
• 5 out of 11 most
popular PLs
(mpPLs)
• 24% of mpPLs
ICS
• 7 out of 11 mpPLs
• 55% of mpPLs
Conclusion
• The differences between Scripting Languages and
Programming Languages are getting more and more
blurred
• languages are becoming compiled or at least hybrid
• languages often operate OS or other applications
– e.g. access to file system
• our distinction is mainly historical
– Java (Pascal) and C++ are taught in intro courses
– we need to expose students to other languages
• ICS exposes you to most of the trending PLs
– already in undergraduate curricullum
– in particular in ICS 215 (and ICS 315)
Our Definition
• now
– JavaScript
– Ruby
– PHP
– Python
– Perl
• in future
– other new programming languages as they
become important