[wp-hackers] Modern Hello Dolly for your review

Jacob Santos wordpress at santosj.name
Mon May 26 20:25:53 GMT 2008

If you are looking for suggestions and tips on Object Oriented 
Programming, then I suggest you pick up some books on the subject. I do 
have suggestions, but they might be as good as Alex's and if that is the 
case, I better not write anything. There are probably only a few people 
here who have the knowledge and experience to answer your question and 
I'm not one of them.

This is the reason why I didn't reply in the first place. I didn't want 
to teach something that I don't know about myself. The blind leading the 
blind? I'll rather not.


Jacob Santos

http://www.santosj.name - blog
http://funcdoc.wordpress.com - WordPress Documentation Blog/Guide Licensed under GPLv2

Also known as darkdragon and santosj on WP trac.

Alexander Beutl wrote:
> Hi Tom,
> seems ok but I only looked some seconds...
> What I would recommend is put the following stuff inside the constructor
> since this would make it possible to create new instances which would add
> themselfe automatically to the right places. Alternativly create a method
> which calls the hooks. This way you can use $this which is perfect since it
> can be used universally when inside the plugin classes methods.
>         if ( function_exists('add_action') ) {
>             // Now we set that function up to execute when the admin_footer
> action is called
>             add_action('admin_footer',
> array(&$matt_hellodolly,'hello_dolly') );
>             add_action('admin_head', array(&$matt_hellodolly,'dolly_css') );
>         }
> What I would really recommend would be to create a parent class "plugin"
> which can be extended. This would drop any needs to check for functions
> since they could be mapped inside this plugin class (which should then be
> part of core and therefor up to date at any time).
> This would make it possible to use something like
> $this->add_action('foo','bar'); instead of the
> add_action('foo',array(&$this,'bar')); which would be really handy.
> Just my thoughts
> Alex
> 2008/5/26 Tom Ransom <automattic.713k at tomransom.com>:
>> Risking considerable flames, I am positing a "modern" Hello Dolly plug-in.
>> I have been working on developing WP plugins for clients and like most,
>> learned by opening and reviewing other's plugins. The first plug-in we all
>> look at is Hello Dolly. But Hello Dolly hasn't changed much since Matt first
>> released it. (and why should it?)
>> I took a few moments this week to put together a "modern" Hello Dolly
>> plug-in that others could use a template.  Some of the features include:
>> - Object-oriented class architecture (with PHP4/PHP5 construct/destruct)
>> - Tests that functions have been defined for executing them
>> - Tests that the class was successful constructed
>>   i.e. shouldn't break WordPress if the API were to change in the future (a
>> best practice?)
>> I am posting this for your comments. I recently finished another plugin
>> using these coding practices and was looking for a peer code review. I
>> thought that Hello Dolly would be a perfect place to get feedback from
>> long-time WordPress hackers on use of classes and coding (and
>> documentation?) best practices.
>> I am attaching Hello Dolly, but on the chance that the mailing list engine
>> strips attachments - I am also posting it at
>> http://1bigidea.com/blog/wordpress
>> Thanks, and I am really looking forward to your feedback after this (U.S.)
>> holiday weekend.
>> regards,
>> Tom Ransom
>> 1bigidea.com
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list