Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am trying to run multiple sites using single code base and code base consist o

ID: 643379 • Letter: I

Question

I am trying to run multiple sites using single code base and code base consist of the following module (i.e. classes)

User module
Q & A module
Faq module
and each class works on MVC pattern i.e. it consist of

Entity class
Helper class (i.e. static class)
View (i.e. pages and controls)
and let's say I have 2 sites site1.com and site2.com. And I am trying to achieve following functionality

site1.com can have User, Q & A and Faq module up and running
site2.com can have User and Q & A module live while Faq module is switched off but it can be turned-on if needed, so my query here is what is the best way to achieve such functionality
Do I introduce a flag bit that I check on every page and control belonging to that module? It's more like CMS where you can turn on/off different features. I am trying to get my head around it, please provide me with an example or point out if I am taking the wrong approach.

Explanation / Answer

How many modules do you have? Are they hardcoded?

If you're in a case where you have only ten possible modules which are written once and require the whole update of the entire application if they need to be updated, then you can easily use checks which will propagate through the models and be used by the views to adjust the user interface (for example by showing or not the appropriate links in the web application menu).

If, instead, you're in a case of many modules developed by many developers and it is unacceptable to require the update of the whole web application in order to update any of those modules, then you should look into plugins model, like for example the one used in FogBugz.

To make a choice, consider the following elements, sorted by importance:

Maintainability: is it acceptable to modify the common code of the web application in order to change any of the modules?

Dependencies: are some modules dependent of others?

Performance: since we don't know the exact context, it's difficult to try to predict the impact of each solution. Maybe there will be none, if you use heavy, cleverly designed caching.

Overall architecture: if there are reasons to do something monolithic (because of the interdependencies), the first solution seems more appropriate; this is not the case if every module is strictly separated from others.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote