How to decouple modules? #3587
Replies: 1 comment
-
Hi @IhorYarovyiCricut, I don't really have anything concrete for you. We don't provide tools specifically for modularity of any kind because this often is very domain specific, and many people like to approach it in many different ways. The state sharing tools ( Dependencies can also be another way, as you have noted. But of course, the problem with using dependencies is that it makes testing more complicated, which is one of the biggest reasons to use TCA in the first place. More responsibility will be on you to assert on everything happening in your dependency, and the library will not be able to help you make sure you asserted on everything. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm experimenting with TCA in a demo project that features two modules:
Notes
andItems
. In this project,ItemsFeature
displays information fromNotesFeature
(for example, a notes counter), and in a real-world scenario, there could be more complex interactions between these modules.Currently,
ItemsFeature
includes the state ofNotesFeature
directly:This creates a direct (vertical) dependency between the features, which, on one hand, enables interaction, but on the other, hinders achieving maximum isolation of the modules. This isolation is important for independently updating different package versions.
I'm considering an approach using a client interface. Instead of directly importing
NotesFeature
intoItemsFeature
, I'd like to create an interface (e.g., a client) that provides data (such as the number of notes) toItemsFeature
. The main app would implement this client interface, allowing the features to remain as decoupled as possible.I have a few questions regarding this setup:
I appreciate any insights, recommendations, or examples you could share to help clarify the best practices for organizing such interactions in TCA.
Thank you for your time and for all the great work you do!
DemoApp.zip
Beta Was this translation helpful? Give feedback.
All reactions