I am looking for an article or other articles on the modular design form. Unfortunately, I did not fully read the article before I lost it, so it may be somewhat vague, but I will try to be as specific as I can be, and explain what I'm trying to do so that someone can suggest other articles .
The article (blog) talked about a programmer who in his experience said that the best way to develop software was in the form of a modular or component approach, so that different components could be selected for different versions of the same or similar software.
The main thing that I remember is a diagram showing different programs on one axis and different components on the other and showing how you can select specific components for certain programs.
The reason I'm looking for this is because I am dealing with some non-object oriented PHP code that is too large to redefine object oriented. This program displays various branded web applications with different but similar rules for each site. Currently, most of the code is as follows:
if($_SESSION['country'] === "Canada" && $_SESSION['brand'] === "X" && $_SESSION['type'] !== "1" || $_SESSION['brand'] !== "Y" && $_SESSION['type'] === "2") { include("mod_something.php"); }
If conditions can be repeated in several places in the code to include different files.
And I would like to review some of them to be more like:
if($_SESSION['component-red'] === true && $_SESSION['country'] === "Canada") { include("mod_something.php"); }
and have component variables set in a central location based on the brand and user choice (sites use the front-loading design or the FrontController design template).
Any suggestions or tips on how to do this would be appreciated, but I'm not quite sure how to research this for code other than OOP.
Thanks.
Edit: I was educated in OOP, but that is not my question.
php design-patterns
Jonathan
source share