Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 1 JavaScript at Ten Years Brendan Eich

Slides:



Advertisements
Similar presentations
Web 2.0 Programming 1 © Tongji University, Computer Science and Technology. Web Web Programming Technology 2012.
Advertisements

3rd Annual Plex/2E Worldwide Users Conference Page based on Title Slide from Slide Layout palette. Design is cacorp Title text for Title or Divider.
Copyright © 2003 Pearson Education, Inc. Slide 6-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Addition Facts
1 A Test Automation Tool For Java Applets Testing of Web Applications TATJA Program Demonstration Conclusions By Matthew Xuereb.
Object Oriented Programming with Java
the javascript language BY SA.
23-Aug-14 HTML/XHTML Forms. 2 What are forms? is just another kind of XHTML/HTML tag Forms are used to create (rather primitive) GUIs on Web pages Usually.
Fawaz Ghali AJAX: Web Programming's Toy.
Essentials for Design JavaScript Level One Michael Brooks
Addition 1’s to 20.
1 What Do I Do at CNS? CNS Information Officer. Editor of CNS Dispatch newsletter and HyperDispatch webzine. Info in paper and electronic formats. Don’t.
Week 1.
Xiao Zhang and Wenliang Du Dept. of Electrical Engineering & Computer Science Syracuse University.
Chapter 13 – Introduction to Classes
1 COMM 1213 H1 COMP 4923 X1 JavaScript 1 (Readings: Ch. 10, 11 Knuckles)
Copyright © IBM Corp., Introducing the new Web Tools JavaScript™ Features Phil Berkland IBM Software Group 9/26/2007.
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
The Web Warrior Guide to Web Design Technologies
JavaScript William Hosbein L1k3 th3 c00l l00k1ng d3s1gn?
Kevin Reuter & Brian Guthrie.  Multi-paradigm  Prototype based objects  Dynamic, weak typing.
Dynamic Web Pages Bert Wachsmuth. Review  Internet, IP addresses, ports, client-server, http, smtp  HTML, XHTML, XML  Style Sheets, external, internal,
J avaScript J JP P resentation Jeff Watson Web & Internet Programming Group.
© 2006 by IBM 1 How to use Eclipse to Build Rich Internet Applications With PHP and AJAX Phil Berkland IBM Software Group Emerging.
Chapter 6 DOJO TOOLKITS. Objectives Discuss XML DOM Discuss JSON Discuss Ajax Response in XML, HTML, JSON, and Other Data Type.
Taking JavaScript Seriously IS NOT THE WORST IDEA.
MVC New release IE8 Beta 1 Deep Zoom (sea dragon) Silver light 2.0 Beta 1 Expression Blend 2.5 Preview Instant Messaging API Enhancements to Virtual Earth.
4.1 JavaScript Introduction
JavaScript: Control Structures September 27, 2005 Slides modified from Internet & World Wide Web: How to Program (3rd) edition. By Deitel, Deitel,
1 Ajax. 2 What’s Ajax? AJAX is a combination of a few technologies that has come together in the past few years AJAX used to be an acronym for Asynchronous.
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
JavaScript JavaScript is a scripting language that is most commonly used to add client- side programming to a web page. Some of the things it is used for.
Ajax Runtime Toolkits IBM Emerging Technologies. What is an AJAX Toolkit/Framework? An AJAX Toolkit/Runtime is more than just XMLHTTPRequest Should includes:
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JavaScript Tabriz university Its September 1995.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
SE-2840 Dr. Mark L. Hornick 1 Modifying webpage behavior using client-side scripting Javascript.
Lesson13. JavaScript JavaScript is an interpreted language, designed to function within a web browser. It can also be used on the server.
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
JavaScript. Overview Introduction: JavaScript basics Expressions and types Expressions and types Arrays Arrays Objects and Associative Arrays Objects.
An Introduction to JavaScript Summarized from Chapter 6 of “Web Programming: Building Internet Applications”, 3 rd Edition.
JavaScript Justin Skinner Programming Languages. JavaScript JavaScript is not Java nor a subset But JavaScript does share the C-family syntax with Java.
Javascript. What is JavaScript? Scripting (interpreted) language designed for the web Beware: JavaScript is case sensitive.
JavaScript scope and closures
1 JavaScript 2.0: Evolving a Language for Evolving Systems Waldemar Horwat Netscape.
1 Javascript CS , Spring What is Javascript ? Browser scripting language  Dynamic page creation  Interactive  Embedded into HTML pages.
Rich Internet Applications 2. Core JavaScript. The importance of JavaScript Many choices open to the developer for server-side Can choose server technology.
Lesson 30: JavaScript and DHTML Fundamentals. Objectives Define and contrast client-side and server-side technologies used to create dynamic content for.
Java Script. introduction Today’s web sites need to go much beyond HTML. browsing through a web site, to actually interact with the web site. The web.
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
JavaScript Katie Fowle November 15, History Brendan Eich at Netscape, 1995 Need for interactivity in web pages Mocha, LiveWire, LiveScript, then.
JQUERY AND AJAX
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
Web Programming Java Script-Introduction. What is Javascript? JavaScript is a scripting language using for the Web. JavaScript is a programming language.
Javascript Prof. Wenwen Li School of Geographical Sciences and Urban Planning 5644 Coor Hall
CSE341: Programming Languages Lecture 21 Dynamic Dispatch Precisely, and Manually in Racket Dan Grossman Spring 2016.
Module 1 Introduction to JavaScript
CSE341: Programming Languages Lecture 21 Dynamic Dispatch Precisely, and Manually in Racket Dan Grossman Spring 2017.
JavaScript Object Model
14 A Brief Look at JavaScript and jQuery.
Java Programming Language
CS5220 Advanced Topics in Web Programming JavaScript Basics
CS3220 Web and Internet Programming JavaScript Basics
JavaScript CS 4640 Programming Languages for Web Applications
CNIT 133 Interactive Web Pags – JavaScript and AJAX
CS3220 Web and Internet Programming JavaScript Basics
Chengyu Sun California State University, Los Angeles
JavaScript CS 4640 Programming Languages for Web Applications
CSE341: Programming Languages Lecture 21 Dynamic Dispatch Precisely, and Manually in Racket Dan Grossman Spring 2019.
Presentation transcript:

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 1 JavaScript at Ten Years Brendan Eich

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 2 Triptych The salad days, green in judgment Maturity, standardization, stagnation AJAX, the JS renaissance, and beyond

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 3 Netscape, Spring 1995 Netscape > 90% browser market share MS buy-out attempt in late 1994 rebuffed Threat to Windows made explicit by Java “Worse is Better!” - marca channeling rpg “We are doomed!” - engineering refrain Very narrow window in which to innovate

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 4 The Web Platform Play Opportunity to do “HTML scripting language” Netscape/Sun “Java deal” cast long shadow Argument by code demonstration necessary I hacked the JS prototype in ~1 week in May And it showed! Mistakes were frozen early Rest of year spent embedding in browser

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 5 Design Goals 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-working, powerful primitives First class functions for procedural abstraction Objects everywhere, prototype-based Leave all else out!

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 6 Marketing, sigh Netscape management fretted: “Why two programming languages?” Answer: division of labor, specialization Java for high-priced components/widgets “Mocha” for mass market web designers “Object-based”, if not object-oriented

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 7 More Marketing Then they changed the name to “LiveScript” Finally, to “JavaScript” in late 1995 Mostly a marketing scam Engineering pressure to “be like Java” did cause us to follow Java into some dead ends (Date inherited y2k bugs from java.util.Date!) Confusion ever since

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 8 JavaScript in Two Slides Objects map strings to values (properties): var obj = new Object; obj[“prop”] = 42;=> obj.prop obj[“0”] = “hello”;=> obj[0] Functions are first-class objects: function fact(n) { return (n <= 2) ? n : n * fact(n-1); } fact.desc = “Factorial function”;

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 9 JS in Two Slides (2) So methods are function-valued properties: obj.frob = function (n) { this.prop += n; }; obj.frob(6);=> obj.prop == 48 Permissiveness throughout. Oops. grob = obj.frob;=> var not necessary grob(6);=> undefined + 6 == NaN prop = “hello”;=> reset global prop grob(6);=> prop == “hello6”

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 10 Full Lexical Closures function Y(g) { return function (f) {return f(f);}( function (f) {return g(function (x) { return f(f)(x); }); } var fact = Y(function (fact) { return function (n) { return (n <= 2) ? n : n * fact(n-1); } }); alert(fact(5));=> 120

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 11 JS Is Self-ish All functions can construct: function Car(make, model) { this.make = make, this.model = model; } myCar = new Car(“Porsche”, “Boxster”); All functions have a prototype property: Car.prototype.color = “black”;=> default color old = new Car(“Ford”, “T”);=> black Model T myCar.color = “silver”;=> my override Powerful when combined with closures

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 12 Where Did All This Lead? Web in early 1996 was text+images Yahoo! home page JS caught on like a bad cold (per plan!) Annoyances (now suppressed by good browsers) proliferated My colleagues made a home page for mehome page

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 13 Things Got Better We’ve come a long way Google Maps Yahoo! webmail (based on oddpost.com) Yahoo! webmail Zimbra, another “AJAX” webmail app Zimbra The “X” in AJAX is for “XML”, specifically XMLHttpRequest, which MS added to IE when they gave Java the boot – ironic!

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 14 What Changed? JS and the “DOM” stabilized Up and coming browsers matched MS IE’s platform features (e.g., XMLHttpRequest) Moore’s Law compounded Hackers discovered JS’s FP and Self-ish OOP features And good hackers like those features

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 15 Hackers Like JS? It’s easy to extend user-defined objects ruby.js for Ruby generic method emulation ruby.js Or built-in objects (Prototype example):Prototype Function.prototype.bind = function(object) { var method = this; return function() { method.apply(object, arguments); }

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 16 Did JS Matter? Wouldn’t this have happened with any winner-take-all browser-based language? Tcl, Perl, Python, Java, VBScript(!) In 1995, not good choices per design goals Event handlers in HTML DOM + JS “easy to use” design goal imply first class functions Hard to work around lack of closures (e.g. using Java anonymous inner classes)

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 17 Closures > Objects JS lacks information hiding a la Java But closures save us again: Function Car(make, model) { this.make = function() {return make;} this.model = function() {return model;} } var myCar = new Car(“Audi”, “A8L”); alert(myCar.make()); // No way to subvert make or model Private static members can be done similarly Private static members

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 18 What’s Not To Like? Aping Java’s use of + for string concatenation Compatibility is king, too late to fix this one Permissiveness: Can call with too few or too many arguments Types convert freely, e.g., “1.0” == 1 && “1” == 1 but “1.0” != “1” (use === instead) Information hiding requires unfamiliar closures Lack of a standard library mechanism

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 19 Where To Next? ECMA standardized JavaScript in 1997 ECMA Revised for ISO in 1998 Revised again in 1999 for major features that missed v1 (what was in Netscape 2-3) E4X extends JS with XML first class object subtype and literal syntax E4X Edition 4 of the ECMA-262 standard under way again, after lengthy hiatus

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 20 ECMA Edition 4 Not deprecating prototypes or dynamic types Will support writing the language in itself Express property get/set methods, declare property attributes, other missing MOP stuff Classes introduced as Self-ish traits objects Namespaces for API versioning Packages for standard library mechanism

Firefox 1.5 Beta 1© 2005, Mozilla Corporation Confidential 21 Conclusion If in a rush, target your audience and simplify Pick the right primitives, support extensions The right primitives for event handling include first class functions and closures Proof: languages such as C# start with Java and grow such features (delegates, lambdas) Don’t let Marketing name your language