Hello,
I wanted to get information on how I should setup a program I'm trying to create with PHP. I want to use OOP, but have the program so that you can add modules to it. So you first install the mainframe, then you keep adding modules to add different features.
Any tutorials, ideas, or suggestions, on how to do this because I have no idea, and I only know basic OOP... any books to read or something?
Chris
Module Program Design
Moderator: General Moderators
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Module Program Design
Joomla...
Re: Module Program Design
If you do OOP right, your architecture will be modular by definition. If each module must adhere to a pre-determined interface, as long as the "framework" ( the code that calls into the modules ) adheres to that interface as well, you can swap out the module without the framework having to change the way it calls it. Basically "modular" programs could be anything from a simple include() statement that uses a variable path name, to a full blown event driven architecture. Usually frameworks are implemented to allow modules to follow MVC, sometimes writing a module will involve overriding a core model, or core controller, or sometimes modules will need their own views as well. It depends where you draw the line between "plugin" and "module".
Re: Module Program Design
I'm designing something like this myself right now, it's really just for personal use, but I want to make it powerful enough to be reusable, like a personal development toolkit. I like the way WordPress and MediaWiki and other more structured CMS systems handle this problem. They use hooks that you simply add to the application bootstrap so every time the app is launched, it simply loads whatever modules are hooked on at runtime and then lets the template figure out where each one comes into play and the back-end configuration to dictate it's performance. Something like that, perhaps. Ideally what I want to try and do is make it a two tiered system that allows for BOTH methods that jshpro2 said. That would allow for extensibility linearly and laterally, but the trick is still making it very flexible.