Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>"I drew a diagram of the import dependencies, and I was planning to aggregate classes by layer level."</strong></p> <p>Python must read like English (or any other natural language.)</p> <p>An import is a first-class statement that should have real meaning. Organizing things by "layer level" (whatever that is) should be clear, meaningful and obvious.</p> <p>Do not make arbitrary technical groupings of classes into modules and modules into packages. </p> <p>Make the modules and package obvious and logical so that the list of imports is obvious, simple and logical.</p> <p><strong>"Also, I was considering some modification to the classes so to reduce these dependencies."</strong></p> <p>Reducing the dependencies sounds technical and arbitrary. It may not be, but it sounds that way. Without actual examples, it's impossible to say.</p> <p>Your goal is clarity. </p> <p>Also, the module and package are the stand-alone units of reuse. (Not classes; a class, but itself isn't usually reusable.) Your dependency tree should reflect this. You're aiming for modules that can be imported neatly and cleanly into your application.</p> <p>If you have many closely-related modules (or alternative implementations) then packages can be used, but used sparingly. The Python libraries are relatively flat; and there's some wisdom in that.</p> <hr> <p><strong>Edit</strong></p> <p>One-way dependency between layers is an essential feature. This is more about proper software design than it is about Python. You should (1) design in layers, (2) design so that the dependencies are very strict between the layers, and then (3) implement that in Python. </p> <p>The packages may not necessarily fit your layering precisely. The packages may physically be a flat list of directories with the dependencies expressed only via <code>import</code> statements.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload