The basic task of a compiler is to read the source program(s) and translate it into a target language and report any errors in the source program to the user. Typically, several source documents or files are to be compiled to create the executable target program. These documents have interdependencies such that one document or file (A) needs to be compiled first before the next one (B) so that it incorporates the code of this document (A) before compiling (B). There are several possible reasons for recompiling the source—one or more of the class files the source would produce are missing or the source has been modified since it was last compiled or one or more of the classes that the source produces depends on a member in another class that changed.
Similar dependencies might be true for some deployment scenarios such as a runtime component (A) may have a dependency on runtime component (B) which is part of a JAR file. If (B) is redeployed, one will need to redeploy (A) and the associated JAR file. As the source code tree evolves, the interdependencies grow thus making the managing of source code relationships and interdependencies an extremely tedious task. As the number of source files increases into hundreds and thousands, due to a large number of interdependencies—some introduced by import statements, the task of build, release, test, and deploy becomes quite cumbersome and time consuming. Building of subtree might cause the compilation of every source code file in the source tree due to circular dependencies. This results in very lengthy build times.
Also, no source code is free to move along under its own development cycle because of interdependencies. As such branching and merging are extremely time-consuming and complex and can introduce significant developer downtime which is highly undesirable. Also, testing and debugging become difficult as it is hard to isolate sub-branches of code to understand their functionality. Finally, releasing production code is tedious as one has to push dependent source files to the production environment. All of the above further gets complicated when working in a team environment where there are multiple authors of the source code.
Poor dependency management leads to code that is hard to change, fragile, and non-reusable. On the other hand, when dependencies are well managed, the code remains flexible, robust, and reusable.