1 javascript-www

1 javascript-www - CS 242 Autumn 2010...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 JavaScript CS 242 Autumn 2010 John Mitchell Reading: links on last slide Homework 1: Sept 22 - 29 Why talk about JavaScript? Very widely used, and growing Web pages, AJAX, Web 2.0 Increasing number of web related applications Illustrates core concepts covered in CS242 Firs class functions First Objects, in a pure form Some interesting trade offs and consequences Powerful modification capabilities Add new method to object, redefine prototype, access caller … Difficult to predict program properties in advance Challenge for implementation, security, correctness Keys to Good Language Design Motivating application C: systems prog, Lisp: symbolic computation, Java: set top box, JavaScript: web scripting Abstract machine Underlying data structures that programs manipulate JavaScript: web page > document object model Theoretical considerations ECMA Standard specifies semantics of JavaScript What’s a scripting language? One language embedded in another A scripting language is used to write programs that produce inputs to another language processor Embedded JavaScript computes HTML input to the browser Shell scripts compute commands executed by the shell Common characteristics of scripting languages String processing–since commands often strings Simple program structure Aviod complicated declarations, to make easy to use Define things “on the fly” instead of elsewhere in program Flexibility preferred over efficiency, safety Is lack of safety a good thing? Maybe not for the Web! JavaScript History Developed by Brendan Eich at Netscape, 1995 Scripting language for Navigator 2 Later standardized for browser compatibility ECMAScript Edition 3 (aka JavaScript 1.5) > ES5, … Related to Java in name only Name was part of a marketing deal Various implementations available Spidermonkey interactive shell interface Rhino: http://www.mozilla.org/rhino/ Browser JavaScript consoles More info later on class site Motivation for JavaScript Netscape, 1995 Netscape > 90% browser market share Opportunity to do “HTML scripting language” Brendan Eich I hacked the JS prototype in ~1 week in May And it showed! Mistakes were frozen earl And it showed! Mistakes were frozen early Rest of year spent embedding in browser Common uses of JavaScript have included: Form validation Page embellishments and special effects Dynamic content manipulation Web 2.0: functionality implemented on web client Significant JavaScript applications: Gmail client, Google maps - ICFP talk, 2006
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Design goals Brendan Eich’s 2006 ICFP talk Make it easy to copy/paste snippets of code Tolerate “minor” errors (missing semicolons) Simplified onclick, onmousedown, etc., event handling, inspired by HyperCard Pick a few hard
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 7

1 javascript-www - CS 242 Autumn 2010...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online