JavaScript

From Lost In Wonderlands
Jump to: navigation, search

JavaScript

NeXT Steps:

more to come : JavaScript Patterns have to be created, on a one page per pattern basis (unless they could be gathered per family e.g. creation patterns etc...)


Everything You Always Wanted to Know About JavaScript... (But Were Afraid to Ask)


See also


JavaScript, the Language

the Language

 * its syntax is very similar to C/C++ or Java
 * blocks of code identified with {} in above languages are actually associated to functions in JavaScript
 * it is an object oriented language
   * everything is an object
   * an object can be thought as an associative, hash coded dynamic array, (key , values)*n
 * it is a functional language
   * functions are first class objects
   * they can own properties as any objects
   * they can be handled as any other objects as , returned values of a function, as parameters to a function etc...
   * variable declarations or variable visibility are associated to functions and more specifically to closures
   * closures are objects associated with functions once they are created as dynamic object
   * closures can store data associated with a function

a few links

 * http://en.wikipedia.org/wiki/JavaScript
 * http://fr.wikipedia.org/wiki/ECMAScript
 * https://developer.mozilla.org/en-US/docs/JavaScript
 * https://developer.mozilla.org/en/JavaScript/Guide
 * http://en.wikipedia.org/wiki/Client-side_JavaScript
 * https://developer.mozilla.org/en/JavaScript_technologies_overview
 * https://developer.mozilla.org/en/JavaScript/Guide
 * https://developer.mozilla.org/en/JavaScript/Reference
 * https://developer.mozilla.org/en/JavaScript/Language_Resources
 * http://userscripts.org/


alternatives & extensions

 * http://javascriptweblog.wordpress.com/2010/07/26/no-more-ifs-alternatives-to-statement-branching-in-javascript/
 * http://en.wikipedia.org/wiki/Trans-compiled


 * Narrative.js
   http://www.neilmix.com/narrativejs/doc/


 * Processing.js
   http://en.wikipedia.org/wiki/Processing.js
   http://processingjs.org/


 * Coffee Script: CoffeeScript to JavaScript
   http://coffeescript.org/


 * oMeta:
   http://tinlizzie.org/ometa/


 * tiscript:
   http://code.google.com/p/tiscript/


 * Haxe:
   http://en.wikipedia.org/wiki/Haxe
   http://haxe.org/


 * Objective-J, Objective c to JavaScript
   http://en.wikipedia.org/wiki/Objective-J


 * Parenscript:  Common list to JavaScript
   http://common-lisp.net/project/parenscript/


 * Emscripten: C/C++ to JavaScript
   https://github.com/kripken/emscripten/wiki
   http://en.wikipedia.org/wiki/Emscripten
   https://github.com/kripken/emscripten
   http://kripken.github.com/llvm.js/demo.html
* LLVM, LLVM.js
  http://llvm.org/
  https://github.com/kripken/llvm-js
  http://kripken.github.com/llvm.js/demo.html


 * Fantom:
   http://en.wikipedia.org/wiki/Fantom_(programming_language)
   http://fantom.org/


 * Type Script:
   http://en.wikipedia.org/wiki/TypeScript
   http://www.typescriptlang.org/
   http://typescript.codeplex.com/


 * Opa:
   http://en.wikipedia.org/wiki/Opa_(programming_language)
   http://opalang.org/


 * Google Dart:
   http://www.dartlang.org/
   http://code.google.com/p/dart/
   http://en.wikipedia.org/wiki/Dart_(programming_language)
 * Mozilla LLJS, Low Level, JavaScript
   http://lljs.org/


 * Google Web Toolkit
   http://en.wikipedia.org/wiki/Google_Web_Toolkit
   https://developers.google.com/web-toolkit/


JavaScript, Tools

also check embedded tools within Web Browsers Chrome, Safari , Firefox, Opera

Building

 * Ant: http://ant.apache.org/
 * Rake: http://rake.rubyforge.org/

Code Static Analysis

 * JSLint: http://www.JSLint.com ,   [| JSLint on github]
    Comes from the book: JavaScript: The Good Parts, o'reilly, by Douglas Crockford
    Douglas Crockford is a Senior JavaScript Architect at Yahoo, JSON introducer and maintener
 * JSHint: http://www.jshint.com/ ,   JSHint on github
    the open source version for JSLint

JavaScript Engines

 * http://en.wikipedia.org/wiki/Presto_(layout_engine)#ECMAScript_engines
 * http://en.wikipedia.org/wiki/JavaScript_engine
 * http://en.wikipedia.org/wiki/SpiderMonkey_(JavaScript_engine)
 * http://en.wikipedia.org/wiki/Tamarin_(JavaScript_engine)
 * http://en.wikipedia.org/wiki/KJS_(KDE)
 * http://en.wikipedia.org/wiki/Narcissus_(JavaScript_engine)
 * http://en.wikipedia.org/wiki/V8_(JavaScript_engine)
 * http://en.wikipedia.org/wiki/Rhino_(JavaScript_engine)
 * http://en.wikipedia.org/wiki/JScript
 * http://en.wikipedia.org/wiki/Chakra_(JavaScript_engine)
 * http://en.wikipedia.org/wiki/Nashorn_(JavaScript_engine)
 * http://en.wikipedia.org/wiki/WebKit#JavaScriptCore


 * http://code.google.com/p/v8-juice/
 * https://github.com/mozilla/narcissus/
 * https://developer.mozilla.org/en-US/docs/SpiderMonkey
 * https://developer.mozilla.org/en-US/docs/Rhino


Debuggers

 * Firebug: http://www.getfirebug.com/

Profiling

 * Page-Speed: http://code.google.com/speed/page-speed/
 * YUI Profiler: http://developer.yahoo.com/yui/profiler/
 * YSlow: http://developer.yahoo.com/yslow/
 * Benchmarking JavaScript : http://benchmarkjs.com/


Minimizing

Minimizing JavaScript Source Code consist to remove comments, spaces, carriage return and/or Line Feed char in order to reduce the size of the source code.

The goal is to reduce the source code size in order to reduce downloading time and web page load time by having less bytes.

Several minimizing tools are also changing variables and functions names to reduce identifier size, contributing to give the source code much less human readable.

However, minifying is not obfuscating the source code and does not protect intellectual property.

 * JSMin: http://www.crockford.com/javascript/jsmin.html
 * Closure Compiler: http://code.google.com/closure/compiler/
 * YUI Compressor: http://developer.yahoo.com/yui/compressor/

Parallelizing

* http://smallcultfollowing.com/babysteps/blog/2013/03/20/parallel-js-lands/
* http://smallcultfollowing.com/babysteps/blog/2013/03/20/a-tour-of-the-parallel-js-implementation/
* https://blog.mozilla.org/luke/2013/03/21/asm-js-in-firefox-nightly/
* http://www.2ality.com/2013/03/parallel-js.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+2ality+%282ality+%E2%80%93+technology%2C+life%29
* http://asmjs.org/
* http://asmjs.org/spec/latest/
* http://programmers.stackexchange.com/questions/193170/what-is-asm-js-and-what-does-it-mean-for-everyone
* http://badassjs.com/post/43420901994/asm-js-a-low-level-highly-optimizable-subset-of

JavaScript, Tutorials

JavaScript, Frameworks

 * Alice.js: http://blackberry.github.com/Alice/
 * Box2d : http://box2d-js.sourceforge.net/
 * cocos2d : http://cocos2d-javascript.org/
 * Javascript 2D Game Engine : http://www.lukewallin.co.uk/?go=engine
 * Node.js :  
   * http://en.wikipedia.org/wiki/Node.js
   * http://nodejs.org/
 
 * jQuery : http://jquery.com/
 * jQuery UI : http://jqueryui.com/
 * jQuery Mobile : http://jquerymobile.com/
 * Tweeter BootStrap : 
 * Wink Toolkit : http://www.winktoolkit.org/
 * WebOS Enyo.js : http://enyojs.com/
Much_more_JavaScript_FrameWorks


HTML5/CSS3/JS Frameworks Snippets

  * JSFiddle: http://jsfiddle.net/
  * JSBin: http://jsbin.com/
  * jsPerf: http://jsperf.com/

JavaScript, GuideLines, Best Practices, Advices

JavaScript Coding Conventions

JavaScript Naming Conventions

JavaScript Writing Comments And API Doc

Writing Comments

Writing APIs Doc

JavaScript, Design Patterns Catalog

DesignPatterns

..about things , we should use, reuse, abuse...

books used

 * JavaScript Patterns, Stoyan Stephanov, O ' Reilly, September 28, 2010
 * Object Oriented JavaScript:…, Stoyan Stefanov, PACKT, July 24, 2008
 * Pro JavaScript Design Patterns, Ross Harmes, Dustin Diaz, APress, December 17, 2007 
 * Hight Performance JavaScript,Nicholas C. Zakas, O'Reilly, March 30 2010
 * Secrets of JavaScript Ninja, John Resig, Bear Bibeault, Manning Publications, March 28, 2012 (pre edition free on the web)

web site:

JavaScript Coding Patterns Catalog

 *  Good Practices 
   *  Minimizing Globals
   *  Problems with Globals
   *  Global Variables Access
   *  Single Var JS Pattern
   *  Hoisting JS Pattern
   *  For Loops
   *  For In loops
   *  Callback JS Pattern
   *  (Not) Augmenting Built-in Prototypes
   *  Switch JS Patterns
   *  Implied Type Casting
   *  Avoiding eval()
   *  Number Conversion with parseInt()
   *  Conditionals
   *  Array Litteral JS Pattern
 *  Coding Patterns 
   *  Returning Functions JS Pattern
   *  Self-Defining Functions JS Pattern
   *  Immediate Functions JS Pattern
   *  Immediate object initialization JS Pattern
   *  Init Time Branching JS Pattern
   *  Lazy Definition JS Pattern
   *  Memoization JS Pattern
   *  Configuration Object JS Pattern
   *  Curry JS Pattern
   *  Primitives Wrappers JS Pattern
 *  Object Creation Patterns 
   *  Namespace JS Pattern
   *  Declaring Dependencies JS Pattern
   *  Private Properties and Methods JS Pattern
   *  Privileged Methods JS Pattern
   *  Enforcing New JS Pattern
   *  Module JS Pattern
   *  Revealing Module JS Pattern
   *  Sandbox Pattern
   *  Object Constants JS Pattern
   *  Chaining JS Pattern
   *  method()Method JS Pattern
 *  Code reuse Patterns 
   *  Classical Inheritance JS Pattern
   *  Modern Inheritance JS Pattern
   *  Default Code Reuse JS Pattern
   *  Rent-A-Constructor Reuse JS Pattern
   *  Rent And Set Prototype Reuse JS Pattern
   *  Share The prototype Reuse JS Pattern
   *  A Temporary Constructor Reuse JS Pattern
   *  Klass JS Pattern
   *  Prototypal Inheritance JS Pattern
   *  Mix-in Pattern
   *  Borrowing Methods JS Pattern
 *  Interface Emulation JS Pattern
 *  Separating Behavior JS Pattern
 *  Regular Expression Literal
 *  Working with JSON


JavaScript Design Patterns Catalog

* Creational Patterns
   *  Factory JS Pattern
   *  Builder JS Pattern
   *  Factory Method JS Pattern
   *  Prototype JS Pattern
   *  Singleton JS Pattern
   
* Structural Patterns
   *  Adapter JS Pattern
   *  Bridge JS Pattern
   *  Composite JS Pattern
   *  Decorator JS Pattern
   *  Façade JS Pattern
   *  Flyweight JS Pattern
   *  Proxy JS Pattern
   *  Wrapper JS Pattern
* Behavioral Patterns
   *  Chain Of Responsibility JS Pattern
   *  Chaining JS Pattern
   *  Command JS pattern
   *  Interpreter JS Pattern
   *  Iterator JS Pattern
   *  Mediator JS Pattern
   *  Memento JS Pattern
   *  Observer JS Pattern
   *  State JS Pattern
   *  Strategy JS Pattern
   *  Template Method JS Pattern
   *  Visitor JS Pattern
* Pattern Oriented Software Architectures
   *  Layers JS Pattern
   *  Pipes And Filters JS Pattern
   *  Blackboard JS Pattern
   *  Broker JS Pattern
   *  Model-View-Controller JS Pattern
   *  Presentation-Abstraction-Control JS Pattern
   *  Microkernel JS Pattern
   *  Reflection JS Pattern
   *  Whole-Part JS Pattern
   *  Master-Slave JS Pattern
   *  Proxy JS Pattern
   *  Command Processor JS Pattern
   *  View Handler JS Pattern
   *  Forwarder-Receiver JS Pattern
   *  Client-Dispatcher-Server JS Pattern
   *  Publisher-Subscriber JS Pattern
 

JavaScript DOM and Browser Design Patterns

 *  DOM Scripting JS Pattern
 *  Events JS Pattern
 *  Remote Scripting JS Pattern
 *  Remote Scripting JS Pattern
 * Deploying JavaScript Patterns
   *  Combining Scripts JS Pattern
   *  Minifying And Compressing JS Pattern
   *  Expires Header JS Pattern
   *  Using a CDN JS Pattern
 * Loading Strategies JS Patterns
   * [[PlaceOf<script>elementJSPattern | Place of <script> element Pattern]]
   *  HTTP Chunking JS Pattern
   * [[Dynamic<script>elementforNonBlockingDownloadsJSPattern | Dynamic <script> element for Non-blocking Downloads JS Pattern]]
   *  Lazy-Loading JS Pattern
   *  Loading on Demand JS Pattern
   *  Pre-Loading JavaScript JS Pattern


JavaScript Anti-Patterns

...about things we should avoid...

AntiPatterns

 * http://jaysoo.ca/2010/05/06/javascript-anti-patterns
 * http://james.padolsey.com/javascript/anti-patterns-in-the-making/
 * http://themoderndeveloper.com/2010/10/javascript-patterns-and-antipatterns/
 * http://www.nczonline.net/blog/2009/04/28/javascript-error-handling-anti-pattern/
 * http://erik.eae.net/archives/2009/11/09/21.12.16/
 * http://blog.bolinfest.com/2009/11/closure-compiler-turns-pattern-into.html
 * http://bolinfest.com/javascript/inheritance.php

References

books used:

 * JavaScript Patterns, Stoyan Stephanov, O'Reilly, September 28, 2010 
 * Object Oriented JavaScript:…, Stoyan Stefanov, PACKT, July 24, 2008 
 * Pro JavaScript Design Patterns, Ross Harmes, Dustin Diaz, APress, December 17, 2007  
 * Hight Performance JavaScript,Nicholas C. Zakas, O'Reilly, March 30 2010
 * JavaScript: The Good Parts, Douglas Crockford, o'Reilly , May 16 2008
 * Secrets of JavaScript Ninja, John Resig, Bear Bibeault, Manning Publications, March 28, 2012 (pre edition free on the web)
 * JavaScript: The Good Parts, o'reilly, by Douglas Crockford, May 2008

web sites:

 * http://www.slideshare.net/stoyan/javascript-patterns
 * http://www.jspatterns.com/
 * http://www.webreference.com/programming/javascript/ncz/column5/index.html
 * http://jsdesignpatterns.com/
 * http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/ 
 * http://eloquentjavascript.net/
 * http://velocityconf.com/velocityeu/public/schedule/detail/21634
 * http://paulirish.com/2009/perf/
 * http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/
 * http://shichuan.github.com/javascript-patterns/
 * http://sourcemaking.com/