Why? Well it would give us much more power to work as developers, and the separation would make WP much more Unit-Test friendly, what would give us stability, flexibility and compatibility.
Why? Well it would give us much more power to work as developers, and the separation would make WP much more Unit-Test friendly, what would give us stability, flexibility and compatibility.
What is MVC?
I'm guessing, and only a guess, that it's http://en.wikipedia.org/wiki/Model-view-controller
A least WP could make much more use of good class-hierarchies and design-pattern.
Would be great to have a class-based WP that makes extending classes easier...
-1 The joy of Open Source software is that you can do stuff like this yourself. :)
drmike! Yeah :D
Of course functionality would still be the same, i.e. code reuse is possible.
dje, tobias: The "joy of Open Source" equals a complete rewrite of the WordPress software.
We already have a lot of the core functionality encapsulated in classes (there's your models). The basic infrastructure and plugin API looks like a controller to me. And we have themes for the views.
Looks to me like we're done already! :)
Dougal, agreed, the core WordPress really works as MVC, but the Themes don't seem entirely as Views, especially, if you builds an Theme a little more sophisticated.
I don't like either, but maybe ...we need something like Smarty :(
Regards.
PD: srry lang and reopen the post.
The rewrite + query = Controller
The themes = View
The plugin API and WordPress Template API = Model
WordPress already follows the MVC pattern. What you want is the OO MVC Design Pattern, which since WordPress is more procedural than object oriented, I don't see this happening.
I actually do plan on improving the Controller API, but it is unlikely that I'll complete the API or that it will even be accepted into the core.
I concede that WordPress MVC doesn't completely follow the exact definition, but patterns don't have to be. It isn't strict, but it does in fact split the Presentation from the Business Logic and the Controller logic from the Model logic.
There you have it, the basic guideline for being MVC. Thank you. If you want to be strict about it, then please rewrite WordPress or help me rewrite WordPress to be OO and use some Popular PHP5 only Framework.
"darkdragon - The rewrite + query = Controller, The themes = View, The plugin API and WordPress Template API = Model"
Apparently you haven't worked with MVC before. You've managed to lure people into a false definition and reality about true MVC by getting the model and controller confused.
The rewrite would be considered a controller, yes. The query however, is NOT, this is apart of the model IF ANYTHING, even though literally, I would believe this to be a library on-top of the core architecture that would be simply called by the model. Plugins in the core of CMS's break MVC approach somewhat, by allowing libraries to handle input without the use of a mapping to a model or using a controller and a model. Meaning, a plugin can in itself accept input and process that input creating a view without the need of a model and/or controller. In theory you could say it creates a mapping, to me that isn't it at all, because again, it breaks model and view.
Model = Queries
Controller = Rewrite Rules
View = Templates
The core, AKA Template and plugin APIs aren't apart of the MVC, apart from being used by Models. They can however, be extended upon by Extensions located in the MVC structure, and shouldn't be extended by models or plugins, like some or a lot of WordPress plugins do.
Again, I disagree that WordPress uses a basic MVC approach, while they do use a basic OO approach in the core programming they don't touch on MVC that much, they are basically just organizing code that is easy to sort through.
This topic has been closed to new replies.