Very confused about blank modules
Question
Application Type
Reactive

Hi there.

I was adding a new module to my app. The idea was to create a few web blocks inside this new module that I could use on my main module (my Reactive App Module). I thought maybe a blank module would be the right way to approach this? Am I wrong?

Anyways, I started the blank module, but ironically I never imagined it would be completely blank. No themes, no nothing. Nothing imported from OutSystemsUI. What do I do? Do I simply go and import everything from OutSystemsUI manually? Will everything work as expected? I saw there some actions to, like, detect if the device was a tablet etc. Am I supposed to do something with those? I am just too confused.

Another idea I had was to create another Reactive App Module instead of a blank one, then make my home module depend from this new module. But, this new Reactive module would depend on the home module (to have the appropriate themes and all of that), so is it a good practice to make two modules depend on each other? 

I am just very confused as to how to achieve what I need.

Any feedback would be immensely appreciated :')

mvp_badge
MVP
Solution

Hello there again Yizuhi,

The Theme should be defined in a separate module and it should be in the Library layer.

(You can check The Architecture Canvas)

For example, the OutSystemsUI itself is a module from this Library layer and that's why you can reuse it across several modules.

Your Theme should have the same logic. Once you create it, since it will be in the Library layer, you may use it in both of your modules (Home module and Core widgets module) :)


And responding to your question, that would create a circular dependency because your Home module would depend on your Core Widgets module (for the blocks) and your Core Widgets module would depend on your Home module (for the Theme). And you should avoid circular dependencies as much as you can!

So, my suggestion: isolate the Theme to another module, consider it as a Library module and you may reuse it for both modules.


Kind regards,

Rui Barradas

mvp_badge
MVP

Hi Yizuhi,


It is a very bad practice to have two modules depending on each other, this is called a circular dependency and it is one of the violations of a good architecture (you can read more here).


If you want to create a module with screens (a front-end module), you should create a Reactive Web App module instead.

The front-end modules don't depend on others (otherwise you are violating your architecture). They can only have weak dependencies, not strong dependencies. You can read more about strong and weak dependencies here.


Hope it helps.


Kind Regards,
João


Thanks for your reply.

Could I then use the blocks I create in this new Reactive Web Module in my home module (also a Reactive web module)?

mvp_badge
MVP

It depends on the type of module your new module is.

Your module which has the Home is an End User module, if you're also going to create a new module which also has screens, then it would be an end-user module as well and there should be no side references between end user modules. Except, of course, weak dependencies (if you reference a screen from the new module on the old module to use it on a screen redirect, it is a weak dependency and therefore it is allowed).


The image below shows the violations chart, or the anti-patterns to avoid on your architecture:



The image above was taken from the link I shared before about the violations of a good architecture as a recap.


Kind Regards,
João

mvp_badge
MVP

Hello there Yizuhi,

Hope you're doing well.


You can and should create another module where you may have only Blocks. This is usually called a Core Widgets module and it is part of the Core layer.

And yes, you can create it as a Blank module and import what you need. Or you can create it as a Reactive Web Module and it will automatically have OutSystemsUI and other stuff.

This module is used to implement Blocks that should be used by 1 or more End User modules and it is a good architecture practise to avoid side violations and code replication.


You shouldn't have 2 modules depending on each other (because it creates a circular dependency), but you can have a Reactive Web Module (Home Module - End User Layer) depending on another Reactive Web Module (Blocks Module - Core Layer).


In my projects, I always have a Core Widgets module :)


Kind regards,

Rui Barradas

Thank you so much, this answers my question :)

And just to make sure that both my Home module and my Core Widgets module have the same theme, could I make the core widgets module reference the Home module's theme? Or would that create a circular dependency?

Again, thanks for your help.

mvp_badge
MVP
Solution

Hello there again Yizuhi,

The Theme should be defined in a separate module and it should be in the Library layer.

(You can check The Architecture Canvas)

For example, the OutSystemsUI itself is a module from this Library layer and that's why you can reuse it across several modules.

Your Theme should have the same logic. Once you create it, since it will be in the Library layer, you may use it in both of your modules (Home module and Core widgets module) :)


And responding to your question, that would create a circular dependency because your Home module would depend on your Core Widgets module (for the blocks) and your Core Widgets module would depend on your Home module (for the Theme). And you should avoid circular dependencies as much as you can!

So, my suggestion: isolate the Theme to another module, consider it as a Library module and you may reuse it for both modules.


Kind regards,

Rui Barradas

Thank you SO SO much, this solves a lot of my problems :D


mvp_badge
MVP

Sure thing Yizuhi,

I'm glad that I could help :)

Happy coding!


Kind regards,

Rui Barradas

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.