Returning Data vs Returning Functionality in Modular Packages: A Discussion

This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.

<@U783MOJYF8Z> just said in the above thread (https://rubymod.slack.com/archives/C02TLU33RNW/p1657733877275369)

My conclusion is that while you might often want “just structs”, in many other cases you want to be able to return behavior that is then injected into other packages.

New :thread: !

I have observed the same

And still we are moving forward with a new gradual modularity / package protection rule for only returning data at the boundary :slightly_smiling_face:

I have a theory that packages fall into two groups: the ones that should return data and those that should return functionality. The latter group - I think - is (as a tendency) lower-level, less domain-oriented, more technical.

For example, we have a wrapper for background jobs - it has a base class for jobs in the public API! … I feel these packages want to be libraries when they grow up

Domain packages … more data-only at the boundary … if anything, want to be standalone sevrices → hence messages at the boundary → hence structs of data as parameters