Benefits of creating new modules in my application

Can someone explain to me what pourpuse is for creating new modules in an angularjs application, I already read the documentation, but we are not quite sure when it is suitable to create a new module or use our own application module when creating a new service, directive etc.

+4
source share
2 answers

I would like to answer this question in a more general style than to be specific.

Why wasn't ISS built as one giant station instead of several independent modules? The reason for the modules is to separate responsibilities, separate design, etc. As far as programming is concerned, it means having logic distributed across several small modules. Thus, you not only know exactly where to look if something goes wrong, or you need to expand some functions, it also ensures that your entire ISS (your application) will not completely fail if one of your modules will fail. This, of course, also requires certain aspects of the programming styles most important in this context in order to maintain the interaction of modules and communication loosely coupled (which I just assume).

Therefore, whenever you want to introduce new material that does not fit in any other existing code or module, you must create a new independent module specialized to perform a specific task.

Even if I do not use AngularJS on regular databases, I am sure that the same idea of ​​modulation will fit there.

0
source

I would like to add some thoughts after reading a little more about the subject:

JAndy, you are right in the general concept, but to be more specific, when you need to use angularjs modules, I think I got a clear answer in this post

Basically, we have 3 ways to structure our projects with corner projects:

  • angular -seed
  • Yeoman
  • Project structure in modules

Depending on how big your project is, you can take one aproach or another.

Basically creating new modules in angularjs helps you pack related functions, one of the advantages of this approach is that if a new developer is part of your team, he can get a general overview and find something easier than if you had only one module, the other is the reuse of functions compared to other projects.

+1
source

All Articles