There Is No JavaScript Noam Kfir Senior Architect, Sela Group http://noam.kfir.cc @NoamKfir
A Brief History of JavaScript
The Bubbling Pool Brendan Eich hacked JavaScript together in ten days
The First Decade Happened • JavaScript was handed to a committee • The browsers went to war • A bunch of languages fought and JavaScript won • The web got big
The Mesozoic Lair John Resig raised JavaScript out of the swamp
The Second Decade Happened • IE6 died a slow painful death • We got standards and frameworks and tools • JavaScript spread to Node.js and MongoDB and Johnny Five!
And Then Things Got Weird
But First, A Little Exercise! Yes, we’re going to get physical…
Nod Your Head if you use JavaScript
Clap Your Hands if you love JavaScript
Pound Your Feet if you hate JavaScript
Real Programmers Multi-Task Use it. Love it. Hate it. Nod. Clap. Pound. But why?
Let’s Ask Expert! Douglas Crockford, 2001 “JavaScript is the world’s most misunderstood programming language.” The
Most Misunderstood • the name carries misleading implications • typecasting and lisp in c’s clothing • moving target and design errors • amateurs and lousy implementations • bad books and a substandard standard • not really object-oriented?
But Not Anymore • Crockford was right, but things have changed • JavaScript is no longer misunderstood • So the question remains… Why?
Typology
Dynamic? Yes
Weakly Typed? Yup Except it also has a few strong types
Compiled? Of course not Except that all major JavaScript engines perform JIT (and AOT?) compilation today Or maybe even grunt and gulp and webpack?
Interpreted? Definitely! Actually, interpreted semantics Which change under strict mode And again for ES6
Functional? Yes… high-order functions And no… side effects and immutable semantics Unless ES5: filter, map, reduce, some, defineProperty… Or ES6: consts, arrow functions, destructuring, generators… Or ES7: async, observe…
Inheritance? Absolutely, but it’s weird Prototypes, not classes Except in ES6, where classes are actually prototypes Or the gazillion logical class implementations, which are mostly abstractions for prototypes or glorified mixins
Modules? Nope, not really Unless you use specific design patterns Or hacks, like immediate functions Or a framework that rolls its own, like Angular Or AMD (RequireJS) Or CommonJS (Node.js) Or ES6 modules
Expressive? It really depends on who you ask But before jQuery showed us the way, most programmers did not see it as expressive or use it that way
So JavaScript Is… • Clearly dynamic • Mostly weakly typed • Kind of interpreted yet also compiled • Trending toward but not quite functional • Inherently mixed up about inheritance • Inconsistently modular • Subjectively expressive
WTF?!!!! JavaScript is no longer misunderstood… But it is confusing JavaScript is a buffet!
Coping Strategies
The Ostrich Ignore JavaScript “We don’t need no stinkin’ JavaScript!” • Go native • Or stick to the server • … And curse Brendan Eich
The Chameleon Hide JavaScript “the assembly language of the web” • JavaScript is ugly • So compile familiar languages “down” • Or invent “prettier” languages to transpile
The Phoenix Reinvent JavaScript “The king is dead. Long live the king.” • Improve JavaScript gradually • Or drastically • Or create a “better” superset
The Kangaroo Skip Over JavaScript “cut out the middleman” • Use an alternative in the browser (like Dart or VBScript) • Or go binary (with WebAssembly)
The Dinosaur Stop Changing JavaScript “Why ruin a good thing?” • It works, leave it alone • The advantage of living in the past is that it’s all documented
Coping Strategies • The Ostrich: ignore JavaScript • The Chameleon: hide JavaScript • The Phoenix: reinvent JavaScript • The Kangaroo: skip over JavaScript • The Dinosaur: stop changing JavaScript
There Seems to Be a Pattern And it’s not the animals
Hint #1 – The Environment In which environments does your JavaScript run? • In the browser? • On the server? • In the database? • On some device? • Everywhere?
Hint #2 – The Ecosystem What language do you use to write your code? • JavaScript all the way! • CoffeeScript? • TypeScript or Flow? • C# or Java? • Anything but JavaScript?
Hint #3 – The Language Which JavaScript do you actually use? • ES3? • ES5? • ES6? • Some other version? • Do you even know?
Hint #4 – The Style Do you have a preferred programming style? • More functional? • More object-oriented? • Whatever the framework prescribes? • Whatever gets the job done? • What are you talking about?
The Problem • JavaScript is ubiquitous, flexible, feature-rich, expressive and popular • But it is also very confusing and suffering from an identity crisis
Converging and Diverging • JavaScript engines are finally converging and are achieving remarkable feature parity, implying eventual consistency across tools, platforms and ecosystems • But the tools, platforms and ecosystems are actually diverging, despite expectations • These are opposing trends
Has JavaScript Peaked? • JavaScript does not seem to be slowing down • But neither is the fragmentation • These are opposing trends
JavaScript Has Evolved • JavaScript’s design has been influenced by many factors and contradictory goals: • open source • competing browsers • a changing web • maturation of the industry • etc. • They have caused fragmentation • But ironically, they have also contributed to its evolution and survival
JavaScript Is Inherently Adaptive • The key to its survival is its adaptability • Its ubiquity and strange typology are evolutionary byproducts • Change is part of its DNA • The language will continue to evolve
Looking Forward • JavaScript is constantly shooting out in new directions • It will hopefully never stabilize • Stabilization will be its death knell • Change makes our lives difficult • In the long run, it’s a necessity
There Is No Spoon • Do not try and bend the spoon. That’s impossible. Instead, only try and realize the truth. • What truth? • There is no spoon. • There is no spoon? • Then you’ll see that it is not the spoon that bends, it is only yourself.
Thank You Noam Kfir Senior Architect, Sela Group http://noam.kfir.cc @NoamKfir

There Is No JavaScript

  • 1.
    There Is No JavaScript NoamKfir Senior Architect, Sela Group http://noam.kfir.cc @NoamKfir
  • 2.
    A Brief Historyof JavaScript
  • 3.
    The Bubbling Pool BrendanEich hacked JavaScript together in ten days
  • 4.
    The First DecadeHappened • JavaScript was handed to a committee • The browsers went to war • A bunch of languages fought and JavaScript won • The web got big
  • 5.
    The Mesozoic Lair JohnResig raised JavaScript out of the swamp
  • 6.
    The Second DecadeHappened • IE6 died a slow painful death • We got standards and frameworks and tools • JavaScript spread to Node.js and MongoDB and Johnny Five!
  • 7.
    And Then ThingsGot Weird
  • 8.
    But First, ALittle Exercise! Yes, we’re going to get physical…
  • 9.
    Nod Your Head ifyou use JavaScript
  • 10.
    Clap Your Hands ifyou love JavaScript
  • 11.
    Pound Your Feet ifyou hate JavaScript
  • 12.
    Real Programmers Multi-Task Useit. Love it. Hate it. Nod. Clap. Pound. But why?
  • 13.
    Let’s Ask Expert! DouglasCrockford, 2001 “JavaScript is the world’s most misunderstood programming language.” The
  • 14.
    Most Misunderstood • thename carries misleading implications • typecasting and lisp in c’s clothing • moving target and design errors • amateurs and lousy implementations • bad books and a substandard standard • not really object-oriented?
  • 15.
    But Not Anymore •Crockford was right, but things have changed • JavaScript is no longer misunderstood • So the question remains… Why?
  • 16.
  • 17.
  • 18.
    Weakly Typed? Yup Except italso has a few strong types
  • 19.
    Compiled? Of course not Exceptthat all major JavaScript engines perform JIT (and AOT?) compilation today Or maybe even grunt and gulp and webpack?
  • 20.
    Interpreted? Definitely! Actually, interpreted semantics Whichchange under strict mode And again for ES6
  • 21.
    Functional? Yes… high-order functions Andno… side effects and immutable semantics Unless ES5: filter, map, reduce, some, defineProperty… Or ES6: consts, arrow functions, destructuring, generators… Or ES7: async, observe…
  • 22.
    Inheritance? Absolutely, but it’sweird Prototypes, not classes Except in ES6, where classes are actually prototypes Or the gazillion logical class implementations, which are mostly abstractions for prototypes or glorified mixins
  • 23.
    Modules? Nope, not really Unlessyou use specific design patterns Or hacks, like immediate functions Or a framework that rolls its own, like Angular Or AMD (RequireJS) Or CommonJS (Node.js) Or ES6 modules
  • 24.
    Expressive? It really dependson who you ask But before jQuery showed us the way, most programmers did not see it as expressive or use it that way
  • 25.
    So JavaScript Is… •Clearly dynamic • Mostly weakly typed • Kind of interpreted yet also compiled • Trending toward but not quite functional • Inherently mixed up about inheritance • Inconsistently modular • Subjectively expressive
  • 26.
    WTF?!!!! JavaScript is nolonger misunderstood… But it is confusing JavaScript is a buffet!
  • 27.
  • 28.
    The Ostrich Ignore JavaScript “Wedon’t need no stinkin’ JavaScript!” • Go native • Or stick to the server • … And curse Brendan Eich
  • 29.
    The Chameleon Hide JavaScript “theassembly language of the web” • JavaScript is ugly • So compile familiar languages “down” • Or invent “prettier” languages to transpile
  • 30.
    The Phoenix Reinvent JavaScript “Theking is dead. Long live the king.” • Improve JavaScript gradually • Or drastically • Or create a “better” superset
  • 31.
    The Kangaroo Skip OverJavaScript “cut out the middleman” • Use an alternative in the browser (like Dart or VBScript) • Or go binary (with WebAssembly)
  • 32.
    The Dinosaur Stop ChangingJavaScript “Why ruin a good thing?” • It works, leave it alone • The advantage of living in the past is that it’s all documented
  • 33.
    Coping Strategies • TheOstrich: ignore JavaScript • The Chameleon: hide JavaScript • The Phoenix: reinvent JavaScript • The Kangaroo: skip over JavaScript • The Dinosaur: stop changing JavaScript
  • 34.
    There Seems toBe a Pattern And it’s not the animals
  • 35.
    Hint #1 –The Environment In which environments does your JavaScript run? • In the browser? • On the server? • In the database? • On some device? • Everywhere?
  • 36.
    Hint #2 –The Ecosystem What language do you use to write your code? • JavaScript all the way! • CoffeeScript? • TypeScript or Flow? • C# or Java? • Anything but JavaScript?
  • 37.
    Hint #3 –The Language Which JavaScript do you actually use? • ES3? • ES5? • ES6? • Some other version? • Do you even know?
  • 38.
    Hint #4 –The Style Do you have a preferred programming style? • More functional? • More object-oriented? • Whatever the framework prescribes? • Whatever gets the job done? • What are you talking about?
  • 39.
    The Problem • JavaScriptis ubiquitous, flexible, feature-rich, expressive and popular • But it is also very confusing and suffering from an identity crisis
  • 40.
    Converging and Diverging •JavaScript engines are finally converging and are achieving remarkable feature parity, implying eventual consistency across tools, platforms and ecosystems • But the tools, platforms and ecosystems are actually diverging, despite expectations • These are opposing trends
  • 41.
    Has JavaScript Peaked? •JavaScript does not seem to be slowing down • But neither is the fragmentation • These are opposing trends
  • 42.
    JavaScript Has Evolved •JavaScript’s design has been influenced by many factors and contradictory goals: • open source • competing browsers • a changing web • maturation of the industry • etc. • They have caused fragmentation • But ironically, they have also contributed to its evolution and survival
  • 43.
    JavaScript Is InherentlyAdaptive • The key to its survival is its adaptability • Its ubiquity and strange typology are evolutionary byproducts • Change is part of its DNA • The language will continue to evolve
  • 44.
    Looking Forward • JavaScriptis constantly shooting out in new directions • It will hopefully never stabilize • Stabilization will be its death knell • Change makes our lives difficult • In the long run, it’s a necessity
  • 45.
    There Is NoSpoon • Do not try and bend the spoon. That’s impossible. Instead, only try and realize the truth. • What truth? • There is no spoon. • There is no spoon? • Then you’ll see that it is not the spoon that bends, it is only yourself.
  • 46.
    Thank You Noam Kfir SeniorArchitect, Sela Group http://noam.kfir.cc @NoamKfir

Editor's Notes

  • #3 A Short History of JavaScript on w3c.org https://www.w3.org/community/webed/wiki/A_Short_History_of_JavaScript
  • #4 JavaScript was basically supposed to be a performance optimization.
  • #5 Exciting times… Does anybody cares about the programmers? History - highlights: - browser wars - inconsistencies, standards - ActionScript extended JS - JScript bit the bullet - VBScript bit the bullet - DHTML gave us full access to the DOM - jQuery rewired our brains - Object.create()
  • #6 Only about 150 million internet years ago… jQuery: - unified browsers - made Ajax easy - made JavaScript elegant and professional - solved tons of problems “JQuery is used by 95.5% of all the websites whose JavaScript library we know. This is 65.9% of all websites.” http://w3techs.com/technologies/details/js-jquery/all/all
  • #7 The server, and the database, and Arduino microchip controllers.
  • #8 I want to talk about the current state of JavaScript and where it’s heading.
  • #9 I won’t ask you to stand up, unless…
  • #10 Or shake it. Whatever.
  • #11 Don’t be shy…
  • #12 1. There’s no shame in it. 2. And nobody can you see your feet.
  • #13 Nod you hands, clap your feet, pound your heads.
  • #14 A bit old, but surprisingly some of it is still relevant today!
  • #15 - moving target and design errors: bad choices, outdated opinions, too many versions - object-oriented: encapuslation, inheritance, prototypes? Sections: - the name - lisp in c’s clothing - moving target - design errors - lousy implementations - substandard standard - amateurs - object-oriented
  • #17 A typological analysis is quite revealing. JavaScript today is more confusing than ever!
  • #19 Some strong types: * Int8Array, also 16 and 32 * Uint8Array, also 16 and 32 * Float32Array, also 64
  • #21 strict mode: - no implied global variables in functions - no with statement - no octal literals - restrictions on eval - setting a writeable: false property will throw - deleting a configurable: false property will throw - apply and call do not default to the global object - “this” not bound to the global object by function form - eval and arguments are reserved - arguments not linked to parameters - no more arguments.caller or arguments.callee - duplicate names in an object literal or function parameters are a syntax error based on: https://gist.github.com/sym3tri/2425983
  • #24 immediate functions - self-executing functions - immediately invoked function expressions (IIFEs) ES6 vs. Node.js modules - ES6 import vs. CJS require - CJS can load modules dynamically - ES6 can be synd or async, CJS is never async
  • #26 … I know I’m confused.
  • #27 Obviously, the language was designed by committee… Buffet – smorgasbord – has a bit of everything and you get to choose what you want.
  • #29 They’ll even write Objective-C! Or maybe just stop programming…
  • #30 There are hundreds of languages that compile to JavaScript! It’s almost like they don’t like the language… Assembly is always just the lowest layer. But JavaScript can be any layer. It really depends on your approach. - http://www.slant.co/topics/101/~what-are-the-best-languages-that-compile-to-javascript - https://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-js - compile down: - C#: Script# and DuoCode - Java: GWT and Vaadin - Clojure: ClojureScript - Ruby: Opal - F#: FunScript - Python: pyjamas - transpile: - CoffeeScript - Dart - Haxe (maybe) emscripten talk: http://kripken.github.io/mloc_emscripten_talk/#/5
  • #31 Phoenixes believe that JavaScript is not “just” the assemble language of the web. It is layer-agnostic. - Gradually improve JavaScript: - strict mode - property attributes - new library functions - Drastically change JavaScript - ES6 and ES7: new keywords, operators and semantics) - Create “better” supersets - Flow - TypeScript
  • #32 - specific alternatives: Dart and VBScript - go binary: WebAssembly and asm.js Assembly as the assembly language of the web, except it’s not really an assembly language. Brendan Eich: “we are aiming to develop the Web’s polyglot-programming-language object-file format” https://brendaneich.com/2015/06/from-asm-js-to-webassembly/ Big Web App? Compile It! by Alon Zakai / Mozilla http://kripken.github.io/mloc_emscripten_talk/#/
  • #33 “Vanilla JavaScript” is good just the way it is
  • #41 Are the convergence and divergence mutual?
  • #42 The fragmentation is like a powerful and unstoppable undercurrent.
  • #45 New directions: experimenting with new technologies, adapting to new platforms and environments
  • #46 The moral is: as JavaScript changes, so must we. We have a symbiotic relationship with the language. Nobody wants to be a dinosaur.