javascript as a platform

34
JavaScript as a Platform

Post on 12-Sep-2014

8.298 views

Category:

Technology


1 download

DESCRIPTION

A story about JavaScript History and its future. I'm talking about language design, ECMA standards, JavaScript code generation, and Virtual Machines made on JS.

TRANSCRIPT

Page 1: Javascript as a Platform

JavaScript as a Platform

Page 2: Javascript as a Platform

What you know about JavaScript language

restrictions?Five Monkeys Experiment

A rule, a regulation, or a procedure, is introduced for a reason.

However, after a while, the reason for it is forgotten,

but the rule stays.

Harry Harlow American psychologist

Page 3: Javascript as a Platform

Why people use JavaScript?

My name is Mark,I use JavaScript to hide buttons.

Dan, 18 years. My girl is love in JS!

I’m Mario, JavaScript is all that I learned in my life!

Page 4: Javascript as a Platform

Why you really should use it? I use JS,

just because it works everywhere!

Page 5: Javascript as a Platform

JavaScriptlanguage design

Page 6: Javascript as a Platform

JavaScript

Page 7: Javascript as a Platform

JavaScriptCreated for

Web Designers

Page 8: Javascript as a Platform

JavaScriptCreated for

Web Designers

Weakly typed

Page 9: Javascript as a Platform

JavaScriptCreated for

Web Designers

C-like syntax, makes it appear like an ordinary

procedural language

Weakly typed

Page 10: Javascript as a Platform

JavaScriptCreated for

Web Designers

C-like syntax, makes it appear like an ordinary

procedural language

Has more in common with functional languages

like Lisp or Scheme than with C or Java

Weakly typed

Page 11: Javascript as a Platform

JavaScriptCreated for

Web Designers

C-like syntax, makes it appear like an ordinary

procedural language

Has more in common with functional languages

like Lisp or Scheme than with C or Java

Arrays instead of

Lists

Weakly typed

Page 12: Javascript as a Platform

JavaScriptCreated for

Web Designers

C-like syntax, makes it appear like an ordinary

procedural language

Has more in common with functional languages

like Lisp or Scheme than with C or Java

Arrays instead of

Lists

Objects instead of

Property Lists

Weakly typed

Page 13: Javascript as a Platform

JavaScriptCreated for

Web Designers

C-like syntax, makes it appear like an ordinary

procedural language

Has more in common with functional languages

like Lisp or Scheme than with C or Java

Arrays instead of

Lists

Objects instead of

Property Lists

Lambda functions

Weakly typed

Page 14: Javascript as a Platform

JavaScriptCreated for

Web Designers

C-like syntax, makes it appear like an ordinary

procedural language

Has more in common with functional languages

like Lisp or Scheme than with C or Java

Functions are First Class

Arrays instead of

Lists

Objects instead of

Property Lists

Lambda functions

Weakly typed

Page 15: Javascript as a Platform

JavaScriptCreated for

Web Designers

C-like syntax, makes it appear like an ordinary

procedural language

Has more in common with functional languages

like Lisp or Scheme than with C or Java

Functions are First Class

Arrays instead of

Lists

Objects instead of

Property Lists

Lambda functions

Prototypal inheritance

Weakly typed

Page 16: Javascript as a Platform

JavaScriptCreated for

Web Designers

C-like syntax, makes it appear like an ordinary

procedural language

Has more in common with functional languages

like Lisp or Scheme than with C or Java

Functions are First Class

Arrays instead of

Lists

Objects instead of

Property Lists

ClosuresLambda functions

Prototypal inheritance

Weakly typed

Page 17: Javascript as a Platform

JavaScriptCreated for

Web Designers

C-like syntax, makes it appear like an ordinary

procedural language

Has more in common with functional languages

like Lisp or Scheme than with C or Java

Functions are First Class

Arrays instead of

Lists

Objects instead of

Property Lists

ClosuresLambda functions

Prototypal inheritance

Weakly typed

Run-time evaluation

Page 18: Javascript as a Platform

JavaScript

It Is The World's Most Misunderstood Programming Language

is very mutable, it’s very flexible. You can rename things.

Douglas CrockfordComputer Programmer

Brendan EichAuthor of JavaScript

Page 19: Javascript as a Platform

Founded Netscape companyand created one of the first browsers

1994

1997

Brendan Eich joined Netscape ,to create a programming language for browserand base it on Scheme (a Lisp dialect)

JavaScript is a trademark of Oracle Corporation

Mozilla inherited Netscape’s code-base and official JavaScript

management rights

1995

1998

Rhino engineby Norris Boydreleased

2008 Google released V8 engine

JavaScript engine prototype (Mocha)

1996

LiveConnect released

ECMA Standardization

LiveConnect 2 released

1998 2010

+10

Released NN2with JS support

Page 20: Javascript as a Platform

Ecma International

a standards organizationof information and communication systems

private non-profit

funded in 1961 to standardize computer systems in Europe

≈265standards

Page 21: Javascript as a Platform

1.0 1997 Compromise between Netscape and Microsoft 2.0 1998 Align with ISO/IEC 16262 international standard 3.0 1999 Added regular expressions, try/catch exception 3.1 Yahoo, Microsoft and Google formed group to update of ECMAScript 3 4.0 Abandoned, due to political differences concerning language complexity 5.0 2009 Library support for JSON, and more complete reflection 5.1 2011 Align with 3rd version of ISO/IEC 16262:2011 6.0 Support classes, semantic and syntactic innovations

ECMAScript Language Specification ECMA-262 ISO/IEC 16262

EDITORIAL CHANGES

EDITORIAL CHANGES

MAJOR RELEASE

MAJOR RELEASE

ABANDONED

MAJOR RELEASE

MAJOR RELEASE

COMMUNITY RELEASE

72% of functionality is supported by browsers28% have issues (IE8, FF3.5, OP10.5, Konq 4)

Page 22: Javascript as a Platform

JavaScriptFrameworks

Domain-Specific LanguageHidden low-level operationsOpen Source

John ResigJS Method Overloading

Page 23: Javascript as a Platform

Static code analysisPossible bugs Overcomplicated expressionsSecurity issues Suboptimal codeDead code Language standard violationDuplicate code Code-style disregard

Identify potential problems

JSLint is a good example of such tool

Page 24: Javascript as a Platform

Automaticcode corrections

Makes JavaScript download and run faster. It is a true compiler for JavaScript. It compiles from JavaScript to better JavaScript. Implemented on Java

Speed is very impressive, given that it’s a pure-JavaScript implementation.Implemented on Node.js

Page 25: Javascript as a Platform

Languages compiled into JavaScript

Improvements on syntax levelCompiled JS will work on any JavaScript runtimeRepeating execution speed improvements

The goal of Dart is:ultimately to replace JavaScript as the lingua franca of web development on the open web platform.

TypeScript is for application-scale JavaScript development. Language is a typed superset of JavaScript that compiles to plain JavaScript. Any browser. Any host. Any OS. Open Source.

CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way.The golden rule of CoffeeScript is: "It's just JavaScript".

Page 26: Javascript as a Platform

Classic languages compilation into JSStrongly-Typed JavaScript (STJS)Is an open source JavaScript code generator from a Java source. It is built as a Maven plugin that can be executed after the compilation.

GWTThese allow you to write AJAX applications in Java and then compile the source to highly optimized JavaScript that runs across all browsers, including mobile browsers for Android and the iPhone.

QuicklightThe Saltarelle C# to Javascript compiler allows a developer to write C# code and then compile it to Javascript which can be run in any web browser.

Page 27: Javascript as a Platform

Emscripten is an LLVM to JavaScript compilerIt takes LLVM bitcode (which can be generated from C/C++ using Clang, or any other language that can be converted into LLVM bitcode) and compiles that into JavaScript, which can be run on the web (or anywhere else JavaScript can run).

Using Emscripten, you can:- Compile C and C++ code into JavaScript™ and run that on the web- Run code in languages like Python as well, by compiling CPython from C to JavaScript

Page 28: Javascript as a Platform

V8 JavaScript Engine

Compilation into JS optimized for Browser

V8 is Google's open source JavaScript engine. V8 is written in C++ and is used in Google Chrome.V8 compiles JavaScript to native machine code (IA-32, x86-64, ARM, or MIPS CPUs)

The V8 assembler is based on the Strongtalk assembler

3 key areas to V8's performance: Fast Property Access Dynamic Machine Code Generation Efficient Garbage Collection

Page 29: Javascript as a Platform

JavaScript runs everything

Page 30: Javascript as a Platform

Asm.js C programs compiled to asm.jsIt's just a subset of JavaScript. Mozilla is working on a first implementation for SpiderMonkey.

Page 31: Javascript as a Platform

Emulatorson JavaScript

JSSpeccyZX Spectrum

Matt WestcottEmulated ZX Spectrum

Ben FirshmanEmulated Dandy

JSNESDandy

Kevin O'DwyerEmulated MS DOS

JSDosBoxDOS

Page 32: Javascript as a Platform

Linux 2.6.20

Fabrice BellardEmulated Linux

PC emulator is written in JavaScript. 32 bit x86 compatible CPUNo FPU/MMX/SSE

Yauhen YakimovichAuthor of JSModem

Page 33: Javascript as a Platform

demo

Page 34: Javascript as a Platform

Thank you

Vlad [email protected]

Technical Lead at LLC Pearl.com