[wp-trac] [WordPress Trac] #32470: Abstracting the Widget Classes
WordPress Trac
noreply at wordpress.org
Fri Jun 12 12:54:34 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 jdgrimes):
Replying to [comment:27 Frank Klein]:
> The proposed patch by @jacobsantos seems interesting, but it also is a
lot of code movement. This means that it probably won't make it into a
release very fast, as a lot of testing would have to be done. But yes, it
will still certainly need lots of testing.
I think @jacobsantos intends to maintain full backward compatibility. And
I think that he's also committed to writing unit tests and integration
tests, since that is part of the reason he is proposing these changes.
> Also when working on new abstractions, we need to keep in mind which
classes and methods are currently public. We would need to ensure that
some form of backwards compatibility is maintained, because currently
nothing keeps developers from directly accessing this code in their
projects.
>
> In the meantime, I think we could have tangible benefits by doing
smaller changes, like for example:
> - Making `WP_Widget` an abstract class.
> - Marking the methods that need to be overriden as `abstract`.
> - Marking functions that should not be overriden as `final`.
> - Marking private functions as `private`.
>
> Like that we could progress while working on a larger refactoring.
>
> Why not keep this ticket around for the larger overall planning, and
have a ticket with a smaller scope to go along with #23012, focussing on
improvements to `WP_Widgets` and `WP_Widget_Factory` that can be done
right now.
None of those changes are backward compatible (though for some we could
employ hacks to make them more so). I think when this larger refactoring
is complete, most of those changes won't matter anyway, because many of
the old methods will probably only be there for back-compat anyway. So it
might not be worth the time to do most of them. There might be other
incremental improvements that could be made, though.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32470#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list