Supposed I have a portal style ColdBox application and part of the functionality of that application is to manage users which might interact with the portal.
Now, if I create a calendar module for the portal and I want that calendar to show events for specific users … do I recreate the user business logic within the calendar module or can I (should I) access (and extend) the existing user business logic in the parent application?
I can see advantages (code reuse, no duplication) as well as disadvantages (dependencies, collisions between modules) here. So, are there any best practices or suggestions available?
Jeff…did you ever get any help on this? I was curious what kind of answer you might get too.
I am building a SaaS application, probably very similar in many ways. My first take on your question was that the users code is utilitarian in nature across all modules. In my case, I created a module that handles the administrative and user interfaces to user management that share user business logic so that other modules I create can share the same business logic but not necessarily the user module code since that is just interfaces.
But I was not sure if that would really answer your question.
You can share the code, the reason being is that I am going to say 100% for certain that the modules can’t work without one another.
What that means is that you can when registering your services or models or whatever, you can assign them a name. That means when you inject the code you could reference it like this
property name=“myService” inject=“myService@module”;
In the above example I am assuming that you have done this in your ModuleConfig.cfc
This would mean that you inject it by name, and you don’t get what module you wish to use it in.