Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there any information about WordPress becoming completely OOP in future versions?

share|improve this question

2 Answers 2

up vote 11 down vote accepted

Hi @Eugene:

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.

share|improve this answer
6  
But 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. –  Eugene Apr 5 '11 at 10:18
1  
@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. –  MikeSchinkel Apr 5 '11 at 10:23
    
@Eugene - I've actually once thought about writing a book on this (and related) topics to allow me to fully flesh out why I think OOP is actually not better in many cases, but then I realized it if I were to do so there would be many other things I not be able to do because of lack of time so I decided against it. Someone else can discover and document in depth why OOP is not perfection. BTW, using a debugging IDE like PhpStorm+Zend Debugger makes WordPress a LOT easier to understand. –  MikeSchinkel Apr 5 '11 at 10:25
    
@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. –  petermolnar Apr 5 '11 at 14:51
1  
I'm glad to hear this. OOP would not be an appropriate path for WordPress. –  Ciprian Jan 10 '12 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.