[フレーム]
KEY, PDF1,364 views

Engineering JavaScript

The document is a presentation by Dr. Jim Purbrick, a technical director at Linden Lab, discussing engineering practices in JavaScript, particularly the module pattern and concepts like inheritance and dependency injection. It also highlights the scale of operations at Linden Lab, including their significant use of computing resources and software development approaches. Additional resources and references for further reading are provided at the end.

Embed presentation

Downloaded 33 times
Engineering JavaScript Dr Jim Purbrick Async 10th March 2011
Who Am I? Technical Director at Linden Lab Setup Linden Lab Brighton Software Engineer Musician Freelancer Entrepreneur
That’s No Moon... 35,000 CPU Cores Weekly Releases No Downtime 1.5 MLOC 100 Engineers 10 Years Image: jurvetson C++, Python, Perl, PHP, C#...
21st Century JavaScript Image: Google Image: W3C
Module myOrg = (function(myOrg) { var myApp = myOrg.myApp = myOrg.myApp || {}; function myPrivateFunction() { // Do my thing. } myApp.myPublicFunction = function() { return myPrivateFunction(); } return myOrg; }(myOrg || {}));
myOrg = (function(myOrg) { Class var myApp = myOrg.myApp = myOrg.myApp || {}, myClass = myOrg.myApp.myClass = myOrg.myApp.myClass || {}; myClass.create = function() { var that = {}; myPrivateMethod() { } that.myPublicMethod = function() { myPrivateMethod(); }; return that; }; return myOrg; }(myOrg || {}));
Inheritance myOrg = (function(myOrg) { var myApp = myOrg.myApp = myOrg.myApp || {}, mySub = myOrg.myApp.mySub = myOrg.myApp.mySub || {}; mySub.create = function() { var that = myApp.myClass.create(), myClassMyPublicMethod = that.myPublicMethod; that.myPublicMethod = function() { // Do something. return myClassMyPublicMethod(); }; return that; }; return myOrg; }(myOrg || {}));
Dependency Injection myOrg = (function(myOrg) { var myApp = myOrg.myApp = myOrg.myApp || {}, mySub = myOrg.myApp.mySub = myOrg.myApp.mySub || {}; mySub.create = function(params) { var that = params.constructor(), myClassMyPublicMethod = that.myPublicMethod, $ = params.jQuery; that.myPublicMethod = function() { return myClassMyPublicMethod(); }; return that; }; return myOrg; }(myOrg || {}));
Production <script type="text/javascript"> $(window).load(function() { var params, mySubInstance; params = { constructor: myOrg.myClass.create, jQuery: jQuery }; mySubInstance = myOrg.myApp.mySub.create(params); // Do something with mySubClassInstance. }; </script>
Test JsHamcrest.Integration.QUnit(); JsMockito.Integration.QUnit(); test('mySubClass calls super class constructor', function () { var params, mySubInstance; params = { constructor: mockFunction(), jQuery: mockFunction() }; mySubInstance = myOrg.myApp.mySub.create(params); verify(params.constructor, once())(); });
More? 1. http://www.adequatelygood.com/2010/3/ JavaScript-Module-Pattern-In-Depth 2. http://www.crockford.com/ 3. http://oreilly.com/catalog/9780596517748 4. http://docs.jquery.com/Qunit 5. http://jsmockito.org/
Thank You! http://jimpurbrick.com http://18dex.com

More Related Content

Object-Oriented Javascript
KEY
Object-Oriented Javascript
Composition in JavaScript
PDF
Composition in JavaScript
jsDay 2016 recap
PDF
jsDay 2016 recap
Reactive Programming Patterns with RxSwift
PDF
Reactive Programming Patterns with RxSwift
Ruby on Rails Intro
PPT
Ruby on Rails Intro
99 líneas que lo simplifican todo( sin animar)
PPTX
99 líneas que lo simplifican todo( sin animar)
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
PDF
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
みんなで Swift 復習会での談笑用スライド – 2nd #minna_de_swift
PDF
みんなで Swift 復習会での談笑用スライド – 2nd #minna_de_swift
Object-Oriented Javascript
Object-Oriented Javascript
Composition in JavaScript
Composition in JavaScript
jsDay 2016 recap
jsDay 2016 recap
Reactive Programming Patterns with RxSwift
Reactive Programming Patterns with RxSwift
Ruby on Rails Intro
Ruby on Rails Intro
99 líneas que lo simplifican todo( sin animar)
99 líneas que lo simplifican todo( sin animar)
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
みんなで Swift 復習会での談笑用スライド – 2nd #minna_de_swift
みんなで Swift 復習会での談笑用スライド – 2nd #minna_de_swift

What's hot

Groovy Api Tutorial
PPTX
Groovy Api Tutorial
Reactive Programming with RxSwift
PDF
Reactive Programming with RxSwift
clara-rules
PDF
clara-rules
Javascript & Ajax Basics
PDF
Javascript & Ajax Basics
How to practice functional programming in react
PDF
How to practice functional programming in react
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
PDF
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
2016 gunma.web games-and-asm.js
PDF
2016 gunma.web games-and-asm.js
非同期javascriptの過去と未来
PDF
非同期javascriptの過去と未来
20151224-games
PDF
20151224-games
Functional Reactive Programming - RxSwift
PDF
Functional Reactive Programming - RxSwift
JavaScript Sprachraum
PPTX
JavaScript Sprachraum
Spark Jobserver
PDF
Spark Jobserver
Reactive programming with RxSwift
PDF
Reactive programming with RxSwift
G*なクラウド 〜雲のかなたに〜
PDF
G*なクラウド 〜雲のかなたに〜
Introduction to cron queue
PDF
Introduction to cron queue
Include
DOCX
Include
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
PDF
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
Swift & ReactiveX – Asynchronous Event-Based Funsies with RxSwift
PDF
Swift & ReactiveX – Asynchronous Event-Based Funsies with RxSwift
Js interpreter interpreted
PDF
Js interpreter interpreted
倒计时优化点滴
PDF
倒计时优化点滴
Groovy Api Tutorial
Groovy Api Tutorial
Reactive Programming with RxSwift
Reactive Programming with RxSwift
clara-rules
clara-rules
Javascript & Ajax Basics
Javascript & Ajax Basics
How to practice functional programming in react
How to practice functional programming in react
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
2016 gunma.web games-and-asm.js
2016 gunma.web games-and-asm.js
非同期javascriptの過去と未来
非同期javascriptの過去と未来
20151224-games
20151224-games
Functional Reactive Programming - RxSwift
Functional Reactive Programming - RxSwift
JavaScript Sprachraum
JavaScript Sprachraum
Spark Jobserver
Spark Jobserver
Reactive programming with RxSwift
Reactive programming with RxSwift
G*なクラウド 〜雲のかなたに〜
G*なクラウド 〜雲のかなたに〜
Introduction to cron queue
Introduction to cron queue
Include
Include
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
Swift & ReactiveX – Asynchronous Event-Based Funsies with RxSwift
Swift & ReactiveX – Asynchronous Event-Based Funsies with RxSwift
Js interpreter interpreted
Js interpreter interpreted
倒计时优化点滴
倒计时优化点滴

Similar to Engineering JavaScript

Javascript Design Patterns
PDF
Javascript Design Patterns
Design patterns in java script, jquery, angularjs
PDF
Design patterns in java script, jquery, angularjs
Advanced Javascript
PPT
Advanced Javascript
Advanced Javascript
PPT
Advanced Javascript
Object Oriented JavaScript
PPT
Object Oriented JavaScript
Download Complete JavaScript for NET Developers 1st Edition Ovais Mehboob Ahm...
PDF
Download Complete JavaScript for NET Developers 1st Edition Ovais Mehboob Ahm...
Say It With Javascript
PDF
Say It With Javascript
JavaScript (without DOM)
PPTX
JavaScript (without DOM)
Design patterns in javascript
PDF
Design patterns in javascript
JavaScript Core
PDF
JavaScript Core
Orlando BarCamp Why Javascript Doesn't Suck
PDF
Orlando BarCamp Why Javascript Doesn't Suck
HTML5 for the Silverlight Guy
PDF
HTML5 for the Silverlight Guy
Advanced Javascript
PPT
Advanced Javascript
Javascript tid-bits
KEY
Javascript tid-bits
Ajaxworld
PPTX
Ajaxworld
運用Closure Compiler 打造高品質的JavaScript
PDF
運用Closure Compiler 打造高品質的JavaScript
Built to last javascript for enterprise
PPTX
Built to last javascript for enterprise
Douglas Crockford Presentation Goodparts
PPT
Douglas Crockford Presentation Goodparts
Unleashing the Power of Modern Javascript Development
PDF
Unleashing the Power of Modern Javascript Development
JavaScript - Introduction
PPTX
JavaScript - Introduction
Javascript Design Patterns
Javascript Design Patterns
Design patterns in java script, jquery, angularjs
Design patterns in java script, jquery, angularjs
Advanced Javascript
Advanced Javascript
Advanced Javascript
Advanced Javascript
Object Oriented JavaScript
Object Oriented JavaScript
Download Complete JavaScript for NET Developers 1st Edition Ovais Mehboob Ahm...
Download Complete JavaScript for NET Developers 1st Edition Ovais Mehboob Ahm...
Say It With Javascript
Say It With Javascript
JavaScript (without DOM)
JavaScript (without DOM)
Design patterns in javascript
Design patterns in javascript
JavaScript Core
JavaScript Core
Orlando BarCamp Why Javascript Doesn't Suck
Orlando BarCamp Why Javascript Doesn't Suck
HTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
Advanced Javascript
Advanced Javascript
Javascript tid-bits
Javascript tid-bits
Ajaxworld
Ajaxworld
運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScript
Built to last javascript for enterprise
Built to last javascript for enterprise
Douglas Crockford Presentation Goodparts
Douglas Crockford Presentation Goodparts
Unleashing the Power of Modern Javascript Development
Unleashing the Power of Modern Javascript Development
JavaScript - Introduction
JavaScript - Introduction

Recently uploaded

Artificial Intelligence(AI) full Book.pdf
PDF
Artificial Intelligence(AI) full Book.pdf
Industrial RFID Landscape for 2025 - Readers, Tags, Antennas, Printers, etc
PDF
Industrial RFID Landscape for 2025 - Readers, Tags, Antennas, Printers, etc
Navigating the Spectrum of Advanced AI – Agentic, Autonomous, and Autopoietic...
PDF
Navigating the Spectrum of Advanced AI – Agentic, Autonomous, and Autopoietic...
Artificial Intelligence and Barbarism - Conceptual Map
PDF
Artificial Intelligence and Barbarism - Conceptual Map
Stop Calling It Hallucination: Semantic Drift as AI’s Real Failure Mode
PDF
Stop Calling It Hallucination: Semantic Drift as AI’s Real Failure Mode
The Multiverse of Artificial Intelligence
PDF
The Multiverse of Artificial Intelligence
Uplers' Wrapped | Talent Edition | Year 2025
PDF
Uplers' Wrapped | Talent Edition | Year 2025
MAD (1).pdf Mobile application develipment
PDF
MAD (1).pdf Mobile application develipment
Unit 1.2 Components of a Computer System.pdf
PDF
Unit 1.2 Components of a Computer System.pdf
Benefits of Using the IAC 500 Sensor for Ambient Conditions
PDF
Benefits of Using the IAC 500 Sensor for Ambient Conditions
Top Benefits of Using KVM VPS Hosting for Growing Businesses
PDF
Top Benefits of Using KVM VPS Hosting for Growing Businesses
Digital transformation success powered by EPM and NexInfo.pptx
PPTX
Digital transformation success powered by EPM and NexInfo.pptx
Compare and contrast types of attacks.pptx
PPTX
Compare and contrast types of attacks.pptx
The Next10 Exponential Innovation 2026 TH
PDF
The Next10 Exponential Innovation 2026 TH
Cyber Security Overview-breif note .pptx
PPTX
Cyber Security Overview-breif note .pptx
Groq Series A Investment Memo - Chamath Palihapitiya
PDF
Groq Series A Investment Memo - Chamath Palihapitiya
HDTV and DTV Standards: The United States Opts for a Digital HDTV Standard
PPT
HDTV and DTV Standards: The United States Opts for a Digital HDTV Standard
AI Bot Traffic Surge: Retail Fraud Threat for Age-Restricted Websites
PPTX
AI Bot Traffic Surge: Retail Fraud Threat for Age-Restricted Websites
Digital Marketing Trends in 2026: AI, Data, Content & Future Growth
PDF
Digital Marketing Trends in 2026: AI, Data, Content & Future Growth
_OSHA102_U06_Chemical Safety and Hazard Communication_ 001 (1) (1).pdf
PDF
_OSHA102_U06_Chemical Safety and Hazard Communication_ 001 (1) (1).pdf
Artificial Intelligence(AI) full Book.pdf
Artificial Intelligence(AI) full Book.pdf
Industrial RFID Landscape for 2025 - Readers, Tags, Antennas, Printers, etc
Industrial RFID Landscape for 2025 - Readers, Tags, Antennas, Printers, etc
Navigating the Spectrum of Advanced AI – Agentic, Autonomous, and Autopoietic...
Navigating the Spectrum of Advanced AI – Agentic, Autonomous, and Autopoietic...
Artificial Intelligence and Barbarism - Conceptual Map
Artificial Intelligence and Barbarism - Conceptual Map
Stop Calling It Hallucination: Semantic Drift as AI’s Real Failure Mode
Stop Calling It Hallucination: Semantic Drift as AI’s Real Failure Mode
The Multiverse of Artificial Intelligence
The Multiverse of Artificial Intelligence
Uplers' Wrapped | Talent Edition | Year 2025
Uplers' Wrapped | Talent Edition | Year 2025
MAD (1).pdf Mobile application develipment
MAD (1).pdf Mobile application develipment
Unit 1.2 Components of a Computer System.pdf
Unit 1.2 Components of a Computer System.pdf
Benefits of Using the IAC 500 Sensor for Ambient Conditions
Benefits of Using the IAC 500 Sensor for Ambient Conditions
Top Benefits of Using KVM VPS Hosting for Growing Businesses
Top Benefits of Using KVM VPS Hosting for Growing Businesses
Digital transformation success powered by EPM and NexInfo.pptx
Digital transformation success powered by EPM and NexInfo.pptx
Compare and contrast types of attacks.pptx
Compare and contrast types of attacks.pptx
The Next10 Exponential Innovation 2026 TH
The Next10 Exponential Innovation 2026 TH
Cyber Security Overview-breif note .pptx
Cyber Security Overview-breif note .pptx
Groq Series A Investment Memo - Chamath Palihapitiya
Groq Series A Investment Memo - Chamath Palihapitiya
HDTV and DTV Standards: The United States Opts for a Digital HDTV Standard
HDTV and DTV Standards: The United States Opts for a Digital HDTV Standard
AI Bot Traffic Surge: Retail Fraud Threat for Age-Restricted Websites
AI Bot Traffic Surge: Retail Fraud Threat for Age-Restricted Websites
Digital Marketing Trends in 2026: AI, Data, Content & Future Growth
Digital Marketing Trends in 2026: AI, Data, Content & Future Growth
_OSHA102_U06_Chemical Safety and Hazard Communication_ 001 (1) (1).pdf
_OSHA102_U06_Chemical Safety and Hazard Communication_ 001 (1) (1).pdf

Engineering JavaScript

  • 1.
    Engineering JavaScript Dr Jim Purbrick Async 10th March 2011
  • 2.
    Who Am I? Technical Director at Linden Lab Setup Linden Lab Brighton Software Engineer Musician Freelancer Entrepreneur
  • 3.
    That’s No Moon... 35,000 CPU Cores Weekly Releases No Downtime 1.5 MLOC 100 Engineers 10 Years Image: jurvetson C++, Python, Perl, PHP, C#...
  • 4.
    21st Century JavaScript Image: Google Image: W3C
  • 5.
    Module myOrg = (function(myOrg) { var myApp = myOrg.myApp = myOrg.myApp || {}; function myPrivateFunction() { // Do my thing. } myApp.myPublicFunction = function() { return myPrivateFunction(); } return myOrg; }(myOrg || {}));
  • 6.
    myOrg = (function(myOrg) { Class var myApp = myOrg.myApp = myOrg.myApp || {}, myClass = myOrg.myApp.myClass = myOrg.myApp.myClass || {}; myClass.create = function() { var that = {}; myPrivateMethod() { } that.myPublicMethod = function() { myPrivateMethod(); }; return that; }; return myOrg; }(myOrg || {}));
  • 7.
    Inheritance myOrg = (function(myOrg) { var myApp = myOrg.myApp = myOrg.myApp || {}, mySub = myOrg.myApp.mySub = myOrg.myApp.mySub || {}; mySub.create = function() { var that = myApp.myClass.create(), myClassMyPublicMethod = that.myPublicMethod; that.myPublicMethod = function() { // Do something. return myClassMyPublicMethod(); }; return that; }; return myOrg; }(myOrg || {}));
  • 8.
    Dependency Injection myOrg = (function(myOrg) { var myApp = myOrg.myApp = myOrg.myApp || {}, mySub = myOrg.myApp.mySub = myOrg.myApp.mySub || {}; mySub.create = function(params) { var that = params.constructor(), myClassMyPublicMethod = that.myPublicMethod, $ = params.jQuery; that.myPublicMethod = function() { return myClassMyPublicMethod(); }; return that; }; return myOrg; }(myOrg || {}));
  • 9.
    Production <script type="text/javascript"> $(window).load(function() { var params, mySubInstance; params = { constructor: myOrg.myClass.create, jQuery: jQuery }; mySubInstance = myOrg.myApp.mySub.create(params); // Do something with mySubClassInstance. }; </script>
  • 10.
    Test JsHamcrest.Integration.QUnit(); JsMockito.Integration.QUnit(); test('mySubClass calls super class constructor', function () { var params, mySubInstance; params = { constructor: mockFunction(), jQuery: mockFunction() }; mySubInstance = myOrg.myApp.mySub.create(params); verify(params.constructor, once())(); });
  • 11.
    More? 1. http://www.adequatelygood.com/2010/3/ JavaScript-Module-Pattern-In-Depth 2. http://www.crockford.com/ 3. http://oreilly.com/catalog/9780596517748 4. http://docs.jquery.com/Qunit 5. http://jsmockito.org/
  • 12.

Editor's Notes

AltStyle によって変換されたページ (->オリジナル) /