Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

JavaScript: The Machine Language of the Ambient Computing Era

Keynote Presentation at Front-Trends 2013
Warsaw, Poland
April 5, 2013

We are well into the transition away from PC centric computing. But the new order isn't just about mobile phones and tables. It's about all of us living in a world that is augments by the ambient presence of billions of computing devices. And they're all going to be programming using JavaScript! Well, at least a lot of them will be. In this presentation I'll be discussing how JavaScript is changing the world, and how the world is changing JavaScript..

  • Be the first to comment

JavaScript: The Machine Language of the Ambient Computing Era

  1. 1. JavaScript: The Machine Language ofthe Ambient Computing EraTalk, by Allen Wirfs-BrockMozilla Research FellowProject Editor, Ecma-262 (The JavaScript Standard)@awbjsFront-trends 2013, Warsaw 2011, April 25, 2013We are well into the transition away from PC centric computing. But the new order isnt justabout mobile phones and tables. Its about all of us living in a world that is augments by theambient presence of billions of computing devices. And theyre all going to be programmingusing JavaScript! Well, at least a lot of them will be. In this presentation Ill be discussing howJavaScript is changing the world, and how the world is changing JavaScript..
  2. 2. The Rise and Fall of Personal Computinghttp://www.asymco.com/2012/01/17/the-rise-and-fall-of-personal-computing/
  3. 3. A New Era of Computing?1950 1960 2000 2010 2020199019801970SocietalImpactCorporate ComputingPersonal ComputingComputersempower/enhanceenterprise tasksComputersempower/enhanceindividuals’ tasks AmbientComputingComputersempower/enhance
  4. 4. Every Computing Era Has aDominant Application Platforms• Corporate Computing Era: IBM Mainframes• Personal Conmputing Era: Microsoft/Intel PC• Ambient Computing Era: The Web is the Platform?Created by Market Demand,“Good Enough” Technical Foundation,and Superior Business Execution
  5. 5. Each Computing Era has had CanonicalProgramming Languages• Corporate Computing Era – COBOL/Fortran• Personal Computing Era – C/C++ family• Ambient Computing Era – JavaScript ??
  6. 6. Why JavaScript?The economics of ubiquity. It’s already there Widest reach Lowest risk Write libraries and apps once Single knowledge and skill set http://odetocode.com/Blogs/scott/archive/2009/03/18/signs-that-your-javascript-skills-need-updating.aspxBecause “Worse is Better”Dick Grabrielhttp://www.dreamsongs.com/WorseIsBetter.htmlIs it even possible to replace it?
  7. 7. The Web Is the PlatformRenderingLayoutStylingNetwork LocalstorageUserInputLanguage RuntimeHTML CSS SVGJavaScriptFrameworks and LibrariesThe WebApplicationPlatform
  8. 8. Firefox OS on Raspberry Pihttp://www.philipp-wagner.com/ffos-for-rpi/manual/index.htmlhttp://www.philipp-wagner.com/blog/2013/04/firefox-os-for-raspberry-pi-now-available/http://www.philipp-wagner.com/ffos-for-rpi/download/rpi-b2g-image-raspberrypi-20130411092136.rootfs.rpi-sdimg.bz2
  9. 9. But what about…Answer: Functionality and Performance
  10. 10. MultitouchAccelerometerCamerasSpeakerMicrophoneBluetoothHardware Keys Light SensorNFCUSB AccessVibration MotorProximity SensorGyroFunctionality
  11. 11. Communications APIsBluetoothMobile ConnectionNetwork ConnectionNetwork StatsTCO SocketTelephonyWebSMSWiFi InfoPush NotificationNFCWebRTCHardwareAccess APIsAmbient Light SensorBattery StatusCameraPointer LockProximityScreen OrientationVibrationWebFMGeoLocationUSBAlarmApp ManagementIdle PermissionsTime/ClockWebPaymentDevice StorageContactsCalandarApp Services APIs
  12. 12. Performance: Parallel JSData parallelism for JavaScript• Goal: exploit multiple-cores, vector instructions, GPUs• Design based upon Intel’s “Rivertrail” prototype• On standardization track• Experimental implementation now in Firefox Nightlyhttp://wiki.ecmascript.org/doku.php?id=strawman:data_parallelism
  13. 13. Parallel JS Examplefunction averageSavingsAterAge(peopleData, age) {age = +age;var peeps = new ParallelArray(peopleData);var pop = peeps.filter(function(person) {return person.age>age});var totalSavings =pop.reduce(function(subtotal,person) {return subtotal+person.savings});return totalSavings / pop.size;}
  14. 14. • Subset of JavaScript thatapproximates a classic VonNeumann computer• asm.js code executesidentically on any Javascriptengine• But a JS engine mayrecognize asm.js code andoptimize for it.• asmjs.org• https://wiki.mozilla.org/Javascript:SpiderMonkey:OdinMonkeyasm.js – C level Performance
  15. 15. C++ to JavaScriptC++sourcecodeClang: C++CompilerFront-endLLVMBitcodeLLVMOptimizerJavaScript(asm.js)sourcecodeJavaScriptEngine (asm.jsaware)JavaScript(asm.js)sourcecodeDevelopment TimeApp Run TimeEmscrptenBetterLLVMBitcode
  16. 16. Source: Alon Zakai (@kripken)http://kripken.github.com/mloc_emscripten_talk
  17. 17. Why not a web bytecode engine?asm.js code is just YAIR(Yet Another Intermediate Representation)function strlen(ptr) {ptr = ptr|0;var curr = 0;curr = ptr;while (MEM8[curr]|0 != 0) {curr = (curr + 1)|0;}return (curr - ptr)|0;}func strlenparam ptr, int32local curr, int32, ptrlabel loopindex8 indx, heap, currread next, indxbne next, exitadd curr, curr, 1goto looplabel exitsub tmp, curr, ptrreturn sub
  18. 18. What is ECMAScript?• ECMAScript is the name of theinternational standard that definesJavaScript• Developed by Technical Committee 39(TC-39) of Ecma International• Issued as a Ecma-262 and ISO/IEC16262• Not part of W3CGoogle Mozilla Microsoft WebkitV8 SpiderMonkey Chakra JSCoreJavaScript Implementations
  19. 19. ECMAScript 6 (and beyond)Goalshttp://wiki.ecmascript.org/doku.php?id=harmony:harmony1. Be a better language for:A. complex applications;B. libraries (including the DOM) shared bythose applications;C. code generators targeting the new edition.2. …
  20. 20. What Kind of Language IsJavaScript?• Functional?• Object-oriented?• Class-based?• Prototype-based?• Permissive?• Secure?Photo by crazybarefootpoet @ flickr (CC BY-NC-SA 2.0)
  21. 21. ECMAScript 6Functional Programming• Arrow functions• Comprehensions• Generators• Tail callsObject-oriented Programming• Class declarations• Concise methods syntax• Super calls• Subclassable built-insES6Feature complete draft December 2013Approved Standard December 2014ES6 Schedule:
  22. 22. Arrow Functionsvar pop = peeps.filter(function(person) {return person.age>age});var pop = peeps.filter(person => person.age>age);Becomes:
  23. 23. var self = this;var pop = peeps.filter(function(person) {return person.age>self.age});Arrow FunctionsBecomes:var pop = peeps.filter(person => person.age>this.age);
  24. 24. Classes Today//define Employee as a subclass of Personfunction Employee(name,id) {Person.call(name);this.id = id;}Employee.prototype=Object.create(Person.prototype);Object.defineProperty(Employee.prototype, “constructor”,{value:Employee,enumerable:false,configurable: true});Employee.__proto__ = Person;Employee.prototype.hire = function() {…};Employee.prototype.fire = function () {…};…
  25. 25. Classes in ES6//ES6 define Employee as subclass of Personclass Employee extends Person {constructor(name,id) {super(name);this.id = id;}hire () {…}fire () {…}…}
  26. 26. Classes Today vs ES6//define Employee as subclass of Personfunction Employee(name,id) {Person.call(name);this.id = id;}Employee.prototype=Object.create(Person.prototype);Object.defineProperty(Employee.prototype, “constructor”,{value:Employee,enumerable:false,configurable: true});Employee.__proto__ = Person;Employee.prototype.hire = function() {…};Employee.prototype.fire = function () {…};…//ES6 define Employee as subclass of Personclass Employee extends Person {constructor(name,id) {super(name);this.id = id;}hire () {…}fire () {…}…}
  27. 27. The Rise and Fall of Personal Computinghttp://www.asymco.com/2012/01/17/the-rise-and-fall-of-personal-computing/
  28. 28. The Rise and Fall of Ambient Computing2005 2008 2011 2014 2017 2020 2023 2026 2029 2032 2035 2038 2041 2044 2047 2050
  29. 29. We’re all collectively creatinga new era of computing.Enjoy it!Own it!
  30. 30. WarsawSaturday, June 1, 2013Apply to attendhttp://bit.ly/FxOSAppWorkshop-applyMore infohttps://hacks.mozilla.org/2013/03/firefox-os-app-workshops/• For skilled JavaScript/HTML5 Developers• Turn your site or webapp into a Firefox OS App• Take home a phone!

×