$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>hooks - Event-Driven Pattern vs MVC?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

hooks - Event-Driven Pattern vs MVC?

matteradmin9PV0评论

In general terms what is it that the MVC framework differs from Event Driven Pattern? Is it even comparable?

eg.: Codeigniter vs Wordpress

I mean while Codeigniter uses MVC it "watches" the Model/Controllel/View,

Wordpress watches events that happens on the website like Initializing(action - init hook), Admin bar initialization(action - admin init), loading the header (wp_head) etc..

I would like to have more insight on my view on this from a professional, thanks

In general terms what is it that the MVC framework differs from Event Driven Pattern? Is it even comparable?

eg.: Codeigniter vs Wordpress

I mean while Codeigniter uses MVC it "watches" the Model/Controllel/View,

Wordpress watches events that happens on the website like Initializing(action - init hook), Admin bar initialization(action - admin init), loading the header (wp_head) etc..

I would like to have more insight on my view on this from a professional, thanks

Share Improve this question asked Feb 1, 2017 at 0:43 JohnthomasJohnthomas 773 silver badges9 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

I will try to explain it simplest as i can:

MVC Framework - Is a framework, that uses MVC software architectural pattern. This pattern sepatares logic in Controller, data in Models, and HTML code in Views. This 3 are separated in different files, so code is cleaner.

Event Driven Pattern - Is a software architecture pattern, that promoting the production, detection, consumption of, and reaction to events.

It's 2 separated things. Wordpress don't use MVC pattern, but uses Event Driven Pattern paradigm. But for example Symfony 3 uses both MVC and Events.

If you want, you can code some event's like libraries in Codeigniter and use events. You can even use MVC patter in WP plugins But this solutions are not that great, if they are not in PHP application by default.

They are 2 different pattern. Modern Frmw give you the chance to use both 2. Wordpress since it's a cms software, use event driven pattern (with the famous hooks) to implements function during the execution, anyway it's up to all developers using a mvc oop as well, or a procedural pattern to display the contents. They're 2 pattern which make something different. One is fish, the others is meat.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far