Folder structure is not a dependency map

A directory shows where files live, but does not explain who imports whom, which modules are central, or which changes will have a large impact radius. Safe planning requires external and internal dependencies, reverse references, and signals of architectural cycles.

ViewQuestion
External dependenciesWhich libraries are declared, and which are actually installed?
Internal dependenciesWhich modules import or call one another?
Reverse dependenciesWho uses the central file or service?
Architectural risksAre there cycles or violations of layer direction?

Start with manifests and the dependency tree

  1. Read manifests and lockfiles.
  2. Separate direct dependencies from transitive ones.
  3. Obtain the full dependency tree when needed.
  4. Analyze imports and calls between internal modules.
  5. Find reverse references for central components.
  6. Add only compact relationships and risks to the inventory.
Examples of commands to adapt
./gradlew dependencies --configuration runtimeClasspath > deps-backend.txt
npm ls --all > deps-frontend.txt

git grep "RefundPolicy" backend/src backend/test

Mark the strength of each conclusion

  • [confirmed] — the relationship was found directly;
  • [needs verification] — there is a signal, but the evidence is incomplete;
  • [unverified] — the area has not yet been investigated.

Dependencies as an impact radius

ObservationPractical conclusion
Many modules reference a serviceThe change has a potentially broad impact
Modules import each otherA separate cycle check is needed
A direct dependency appears only in the manifestIt is declared, but usage still needs confirmation
The relationship is visible only from a folder nameThis is a hypothesis, not evidence

Do not refactor during initial mapping

A discovered cycle or cross-layer import may be an important signal, but discovery and correction are different tasks. First record the dependency, source, and confidence level; decide about refactoring separately.

Canonical lesson source · JavaRush

Open JavaRush material