[wp-trac] [WordPress Trac] #32470: Abstracting the Widget Classes

WordPress Trac noreply at wordpress.org
Mon Jun 1 22:54:08 UTC 2015


#32470: Abstracting the Widget Classes
------------------------------------+------------------------------
 Reporter:  welcher                 |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Widgets                 |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |     Focuses:
------------------------------------+------------------------------

Comment (by jacobsantos):

 So the goal is to introduce interface segregation, single responsibility
 and dependency inversion. Doing so to split out the god object `WP_Widget`
 into separate classes that focus on a single concern. Part of that has to
 do with creating interfaces for both splitting into single concerns as
 well as help with dependency inversion.

 It is my prediction that if WordPress includes better OOP principles in
 the code, that programmers will become better object-oriented programmers.
 I'm not sure whether this claim is falsifiable, given that it is inherent
 in the practices, knowledge and experience of individual programmers. Some
 may embrace better OOP principles and become better programmers, but it is
 unknowable, except through informal polls, whether it was because of
 WordPress or they simply adapted it on their own.

 At the very least, the hope is that core contributors and committers adopt
 better OOP practices and improve the code to allow for more comprehensive
 and better test suite than what is available at the time of this writing.
 Very little of WordPress can be unit tested and forget integration tests
 with much of the existing code base. At best, system test cases can be
 created for majority of the code base with some opportunities for unit and
 integration test cases.

 My goal is to show what better OOP could allow and attempt to convince as
 many contributors and committers as possible that it is in fact possible
 in the code base without breaking backwards compatibility.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32470#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list