Software development is about repeating yourself intelligently by using functions to encapsulate repetitve code, saving you the hassle of writing it out each time. This doesn’t just mean finding a repeatable pattern and going with it, it’s important to find the right pattern. That is where PHP design patterns come into play. While we often think of this in terms of choosing to write a function or class, or to import a library, this approach also extends to application architecture. The architecture of a framework, CMS, plugin, theme, class, or system is often described as conforming to a pattern. Being aware of the classic software PHP design patterns and architectures as well as common patterns employed in WordPress can be very instrumental in helping us write better code. Event Driven Vs. Model View Controller WordPress uses an event-driven architecture, in which there are hooks in the core software and plugins and themes that act as events. When WordPress encounters a hook, it executes all code “hooked” to that event. This loosely conforms to the publisher/subscriber pattern where WordPress or a plugin or theme “publishes” an event with apply_filters()
Share This

We are using cookies on our website

Please confirm, if you accept our tracking cookies. You can also decline the tracking, so you can continue to visit our website without any data sent to third party services.