fabbricadigitale / scimd

SCIM v2 golang implementation
MIT License
5 stars 1 forks source link

Packages interdependencies #10

Closed leogr closed 6 years ago

leogr commented 7 years ago

The current situation is:

Questions:

  1. What are best practices to avoid import cycles?
  2. Should a package avoid to import a package that's parent in path?

Refs #9

leogr commented 7 years ago

schemas could be empty, I've began to move contents away by https://github.com/fabbricadigitale/scimd/commit/8e27fa65095c29852d149a457bf9a31b7269e690

leogr commented 7 years ago

I had some thoughts, finally I described my idea below.

Package's rules of thumb

  1. If a subset of a package is self-contained (*), it SHOULD be moved to its own new package.
  2. A descendant package SHOULD be more specialised than its ancestor.
  3. A package MAY import any other packages but MUST NOT import its descendants.
  4. When a importing cycle still occurs, the less specialised package MUST be refactored to avoid importing the more specialised one.

(*) has no interdependencies with other parts of the packages

Some examples:

cc @leodido @alelb

leodido commented 7 years ago

:+1: