Declaration of transitive dependencies best practice

Topics: Writing modules
Jan 21, 2012 at 8:47 PM
Edited Jan 21, 2012 at 8:48 PM

How would you declare dependencies in the Module.txt files of the following modules?

There's a project structure as following:

  • ModuleA
  • ModuleB
    • Dependencies in: ModuleA, SomeThirdPartyModule
  • ModuleC
    • Dependencies in: ModuleA, ModuleB, SomeThirdPartModule

Those "Dependencies in" lines show which module's code the module directly uses. That means, e.g. there's a class in ModuleC that uses a type declared in ModuleA or ModuleB (or even SomeThirdPartModule).

Now the one shown is already a solution and a quite bullet-proof one. My problem is, that the boxes under Features quickly overflow if many dependencies (especially with long names) are listed and also the Module.txt becomes crowded. In my opinion sometimes the declaration of a dependency can be omitted: here ModuleA is an important module, ModuleB or ModuleC absolutely cannot live without it and this will never change.

Would it be wrong to omit ModuleA from ModuleC's manifest, since ModuleB already depends on it? On the other hand, I think SomeThirdPartModule should be declared in both manifests, as its usage is a maybe temporal implementation detail.

What do you think?

Jan 21, 2012 at 8:53 PM

It's fine to omit dependencies when one implies another; the system understands the dependency tree anyway. Sometimes I include them all purely for clarity.

Jan 21, 2012 at 10:01 PM

Thank! I know it will work anyways, I was just curious if there's some maintenance time bomb or similar :-).