Topics

programming

php drupal scheme scheming macros design patterns da la

design

design css

random thoughts

scribbles

alter ego

other me 'em that link us my space me linked in

Collections

Programmable web
PHP design patterns

guild
observer pattern
Submitted by vlado on Thu, 2006-07-27 08:53.

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

Reply

Please solve the math problem above and type in the result. e.g. for 1+1, type 2
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <br /> <br> <div> <a> <em> <strong> <cite> <pre> <code> <ul> <ol> <li> <dl> <dt> <dd> <h3> <img> <blockquote> <q> <strike> <small> <h4> <h5> <h6>
  • Link to content with [[some text]], where "some text" is the title of existing content or the title of a new piece of content to create. You can also link text to a different title by using [[link to this title|show this text]]. Link to outside URLs with [[http://www.example.com|some text]], or even [[http://www.example.com]].
  • Lines and paragraphs break automatically.
More information about formatting options
Home ยป PHP Design Patterns

dikini.net

spreading confusion by accident since 1970