title: Software License Project: how to avoid circular dependency
body: <p>The title sounds like a bit unclear and I am not sure about the terminology. But my problem is: I am now implementing the license verification function of our software, which consists of several modules. For example, the function call is something like <code>License.IsModuleEnabled(m As Module)</code> (the code is in VB.NET)</p>
  
  <p>Now the thing is, it is common for one module to require another module as a prerequisite, for example, for ModuleA to run, ModuleB must be enabled as well. So in <code>Module</code> class I have a public number called <code>RequiredModules</code> which is a list of <code>Module</code>. So the <code>IsModuleEnabled()</code> function would look something like this:</p>
  
  <pre><code>Public Function(m As Module)
     ...     
     For Each module In m.RequiredModules
         If Not IsModuleEnabled(module) Then Return False
     End For
     ...
  End Function
  </code></pre>
  
  <p>The problem is obvious (but the solution is not to me): if ModuleA requires ModuleB, and ModuleB requires ModuleA, the function would go to a dead loop. </p>
  
  <p>Those modules they are parallel to each other so I don't have a clue how to manage such a verification function. Our current solution is that only some "basic" modules can be listed in the <code>RequiredModules</code>, but for long term, to have all modules possible to appear in the list would be better.</p>