Is there any information about WordPress becoming completely OOP in future versions?
2 Answers
I can say with about 99.9999% certainty that WordPress will never become completely OOP in future version, not the least of which is that the topic has come up time and again on the wp-hackers list and the core team members has expressed no interest in doing so.
As I look at my personal experience with programming and teaching OOP starting around 1990 I agree with the core team and think complete OOP would be a mistake. Although I once an OOP zealot and thought OOP was a panacea I've since come to believe that it has its value in some contexts but in other contexts it gets in the way.
One of the biggest problems I've found with OOP is that it forces the developer to bake in structure long before the developer actually understands what that structure should be which then leads to the fragile base-class problem.
Of course for selected aspects of WordPress, OOP makes a lot of sense and if you study core you'll find such classes; Widget
, List_Tables
(in 3.1), etc.
At this point I'm happy to work with WordPress in a mostly non-OOP paradigm and think that if it had been pure OOP WordPress would have never gained the following it has. Why? Because OOP would have raised the bar of complexity for would-be WordPress themers and plugin developers, and it would likely have resulted in an application that was not flexible enough to evolve as the core team learned more about the needs of its users over the past 6 years.
FWIW.
-
7But you have to agree, that if Wordpress was completely OOP it would be much easier to understand how everything works there. For a developer it is saving a truck of time.– EugeneApr 5, 2011 at 10:18
-
2@Eugene - I actually don't agree with that at all. I once used to believe that OOP was a better way in all cases, but I don't believe that anymore. My guess is that because you are more attuned to OOP you have difficulty understanding WordPress because it is not pure OOP. But as a case-in-point, I recently tried to understand CodeIgnitor and I was overwhelmed by all of its OOP complexity whereas I find WordPress extremely easy to understand. By analogy I can easily understand English; French, not so much. Said more simply, it's what you know. Apr 5, 2011 at 10:23
-
1@Eugene: I don't agree, that it's easier to understand an OOP code. For someone, who's developing in OOP yes, but for me example, using classic ANSI C, not really. Apr 5, 2011 at 14:51
-
1Okei. Got it. OOP bab, Wordpress style good. :) @MikeSchinkel Yep. I use both this tools in my line of work. If you suggest them, then I will give it a try one more time. Thanks for help everyone.– EugeneApr 6, 2011 at 9:08
-
2I'm glad to hear this. OOP would not be an appropriate path for WordPress.– CiprianJan 10, 2012 at 14:28
Lots of WP components get rewritten in OOP code with every new release, and new components tend to make use of it (for example the WP_Customizer
thing). But if you're asking if WP will change its architecture to a fully object-oriented one - then no, there's currently no information that suggests such a thing.
I wouldn't go so far to say that it will never happen, but it's unlikely it will in the near future, and probably not because of the "base-class" problem :)
First of all, there are only disadvantages in using procedural code over OOP for a CMS application like WordPress, simply because such apps are meant to be extended through plugins. Throwing in a mix of functions and global variables doesn't make this easier at all. At the time WP was written nobody could have predicted what WP would become and many poor choices were made. Now it's pretty hard to catch up, because most plugins and themes would stop working properly. Implementing a huge compatibility layer to avoid that would likely slow down WP and add even more confusion among developers. Also think about the purpose - to ease the life of developers, at the users' expense?
If it helps - a very old discussion on wp-hackers but still relevant to this topic, and a proposed idea by the community, now tagged as "plugin territory". I haven't noticed other activity in this direction recently.