Asynchronous module definition

Asynchronous module definition (AMD ) is a JavaScript API that enable modules and their dependencies can be loaded asynchronously. It thus forms (in the sense of object-oriented programming), in the otherwise functional and monolithic JavaScript environment from two basic concepts of software development, modularization, and inheritance.

The procedure is largely based on the inversion of control design pattern ( IoC pattern). This module corresponds to the concept of the bean in the IoC. This makes it possible that also Java Script may be modular. This results in modules that are similar to Java classes, and also can be extended by inheritance as well. Each module has to - be stored in a separate file - similar to the Java class.

Benefits modularization consist especially in the browser environment where JavaScript is used very frequently. There are only the necessary modules are loaded, but not all, as would be the case with synchronous store. The one hand increases the performance of the code and makes it easier on the other hand debugging, particularly in cross-domain access issues. Furthermore, it allows for better reusability of individual code fragments, without having to carry this by copying and pasting or server-side concatenation (server- side concatenation ). This results in a reduction in the use of global variables to a minimum, thus reducing the costs arising from namespace pollution problems significantly.

By specifying the distribution of the code on many individual files, however, also result in disadvantages. Each file must be loaded by the browser in a separate HTTP request, which can generate a lot of protocol overhead of many small files. This can be particularly noticeable in connections with high latency, eg in WLANs delay.

AMD is included inter alia in the framework Dojo Toolkit, MooTools and RequireJS.

84810
de