Well, not exactly the observer pattern, but a close relative. One of the core concepts of the Drupal apis is something called hooks. To cut the long story short - it defines a function naming convention, i.e $module_name . '_' . $hook and hook invoking functions. The idea is that whenever you invoke a hook, the system will automatically discover and call all currently available ones. Actually that is the reason I define the Hook pattern and name it accordingly. You can find closer relative in my earlier aspects and honey post, where the code works/is closer to working :) (you can never be really sure).
I agree that there should be websites showing proper usage of a particular pattern. The problem is that these patterns are a bit artificial. Very rarely you will meet them on their own. Why do you think I was able to generate these pages so quickly? (It took me around 3-4h to write the examples from scratch and I'm not a quick typist). The main reason is that I've spent some time in the past to use some of these patterns and idioms and I've decided to approch this catalogue as quick sketching of solutions to previously defined problems. That's why the format. Then other things started coming to mind.
Well, not exactly the observer pattern, but a close relative. One of the core concepts of the Drupal apis is something called hooks. To cut the long story short - it defines a function naming convention, i.e $module_name . '_' . $hook and hook invoking functions. The idea is that whenever you invoke a hook, the system will automatically discover and call all currently available ones. Actually that is the reason I define the Hook pattern and name it accordingly. You can find closer relative in my earlier aspects and honey post, where the code works/is closer to working :) (you can never be really sure).
I agree that there should be websites showing proper usage of a particular pattern. The problem is that these patterns are a bit artificial. Very rarely you will meet them on their own. Why do you think I was able to generate these pages so quickly? (It took me around 3-4h to write the examples from scratch and I'm not a quick typist). The main reason is that I've spent some time in the past to use some of these patterns and idioms and I've decided to approch this catalogue as quick sketching of solutions to previously defined problems. That's why the format. Then other things started coming to mind.
And thanks for the wise