The well-known problem: washing socks and mixing colorful clothes. Every time we have to put on socks there is always a small difference within chosen pair. Sometimes one sock is missing, sometimes the color is washed more on one, sometimes we can also get nice rouge t-shirt while washing it with lost red sock.
We have a couple of solution for that. As explained below we have to use some kind of bag to pack socks together before putting them in a wash machine.
A few sample modules initialized in main project file:
Sample module from external file:
The developer initializes module in main file but dependencies are declared inside the external file with definition of module. He can easily distinguish initialized modules and dependencies while editing main and module files.
Pros and cons
- modular structure of project
- separated modules with possible data exchange
- easily recognizable module dependencies
- files loaded once but used multiple times
- forces keeping code clean
- ease of introducing a new developer
- without proper optimizing can generate a lot of http requests
- small code overhead
Remember: Wash colors separately. Keep away from fire :)