I've been working with PHP and few more OOP languages and still wondering about the meaning of design pattern and OOP in PHP and similar languages.
I have some modules in my project: news , forum... Each module can be access by calling it main class.
- The main class routes the page ~> point to news/article , news/categories.
- Have some module settings / variables.
And the child classes in each module handle those specific features / pages.
What's the best design pattern for this model? Create instance of the class or it's child?
Now, i initialize a class, and access to the child class static methods like the example bellow. But i've read using static method can slow down the code?
class news {
__construct() {
// define module settings
...
// routing all module pages
categories::list();
}
function modulesetting() {}
}
class categories extends news {
static function list() {}
}
Aucun commentaire:
Enregistrer un commentaire