Development on Va...
Follow
Find tag "module"
6.3K views | +26 today
Development on Various Platforms
Your new post is loading...
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Javascript Modules, AMD, and the road ahead.

Javascript Modules, AMD, and the road ahead. | Development on Various Platforms | Scoop.it

There are many design patterns used in Javascript and I would recommend taking a look at Javascript Patterns by Stoyan Stefanov for a full introduction to the most widely used patterns. Of the design patterns available, the Module pattern has gotten the most recognition in the past few years thanks in part to the maturation of the module pattern via commonjs as well as the wild success of node.js.

 

The Module Pattern

In a nutshell the module pattern allows you to create code that can expose a public API while safe guarding private variables and methods behind a pseudo blackbox.

 

The future looks bright

We’ve looked at the basic Module pattern and seen how to use it to create some really powerful Javascript. We then took a look at how AMD works and how we could easily change our code to build our modules following the Commonjs specification for asynchronous modules, lastly we took a look at the bleeding edge harmony modules specification. I find that it is easy to see the beauty of where ECMAscript 6 is heading, with respect to modules, when you take a look back at where we’ve already been and how we’ve evolved up to this point.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Writing Client-Side JavaScript Modules, AMD, RequireJS & the "wrapper" Module

Writing Client-Side JavaScript Modules, AMD, RequireJS & the "wrapper" Module | Development on Various Platforms | Scoop.it

An often overlooked piece of JavaScript examples, tutorials and discussion is the writing of libraries/modules.

While there is a vibrant community of people writing UI centric jQuery Plugins with a de-facto style and methodology, paging through Github repositories of the many libraries, frameworks, plugins, etc will show an extremely disparate set of coding styles and methods.

 

History, ES6, Transpilers and AMD

 

As more and more browsers support experimental ES6 Module Features, and others use transpilers to write in ES6 transpiling to shim'd JavaScript/ECMAScript5 which export to AMD format & client-side JavaScript becomes even more complex and large, users will use module style coding as the standard.

Regardless of whether or not you want to support CommonJS, RequireJS/AMD or just write a library which aliases its' constructor or main method/object to the window: anyone could benefit from writing small, testable and compartmentalized modules.


Via Jan Hesse
more...
No comment yet.