How to organize behaviour files in a project?

I take it from your post that in this scenario, you would create a folder called “dispatcher” and put all the dispatchers inside it, because they all have the same capabilities.

No. If you look at the post that I linked to there was an inventory capability with a number of “services” under it. If each service had its own dispatcher callback module I would put it inside the corresponding service folder. The behaviour module would end up on a higher level:

  • under inventory if the dispatcher is inventory specific.
  • above inventory if it is more generic

(Using module names as namespaces)

But what about the community norms that defend that for each folder there must be an .ex file with it’s name at the same level?

By all means start out with When In Rome. But find out what the exact justification for the convention is - you may find that at some level some assumption may conflict with your particular situation. Then you have to make a decision whether or not it is worth being different (including documenting exactly why you think you’re special - a plain “I don’t like it” isn’t enough).

For Example:

1 Like