Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

The use of the term "module" is confusing given AMD #2078

Closed
huntc opened this issue Feb 27, 2013 · 2 comments
Closed

The use of the term "module" is confusing given AMD #2078

huntc opened this issue Feb 27, 2013 · 2 comments

Comments

@huntc
Copy link

huntc commented Feb 27, 2013

Definition of an AMD module

AMD declares how to load modules. Modules are functions declared within a call to a define function. Multiple define statements can occur within one script. Where scripts are loaded is not defined by the AMD specification. Indeed the AMD compliant almond.js loader [1] does not manage the loading of files at all, but requires them to have been loaded prior to the require function being invoked.

Description

As a newcomer to Angular.js I find the distinction between AMD modules and Angular modules highly confusing. To that end, and to serve the distinction made elsewhere [2], would deprecating the use of the "module" name and using "component" be more appropriate? In Spring parlance, a component can be auto-wired (injected) and can receive an @PostConstruct annotated method. This is similar to your config and run functions respectively.

A module in AMD terms can contain a collection of components. Perhaps it is useful to think of modules and components being akin to Java's packages and injectable classes respectively.

[1] https://github.com/jrburke/almond
[2] #1382

@pkozlowski-opensource
Copy link
Member

@huntc Unfortunately module, component and package are one of those overloaded words in IT that can mean different things to different people depending on their background etc.

Having said the above AngularJS modules are not at all as Spring components (beans!). If you would have to find an analogy from the Spring world, AngularJS modules would be closer to Spring's containers (although lifecycle is completely different). Spring components / beans are (roughly) equivalent of AngularJS providers (services, factories etc.).

Going to close this one for now as renaming current module to component would create even more confusion IMO. As things stand today AngularJS modules are collections of providers that produce objects instances (services etc.) during runtime. Hope this clarifies things a bit for you.

@huntc
Copy link
Author

huntc commented Feb 28, 2013

Unfortunately I think closing this issue off so rapidly will do nothing to arrest the confusion that is out there.

Perhaps Component is not the correct name, but I do believe that another name should be sought. "Configuration" comes to mind.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants