[wp-trac] [WordPress Trac] #12267: Upgrade loop objects to provide identical presentational interfaces.

WordPress Trac wp-trac at lists.automattic.com
Thu Feb 18 03:00:39 UTC 2010


#12267: Upgrade loop objects to provide identical presentational interfaces.
-------------------------+--------------------------------------------------
 Reporter:  andy         |       Owner:            
     Type:  enhancement  |      Status:  new       
 Priority:  normal       |   Milestone:  Unassigned
Component:  General      |     Version:            
 Severity:  normal       |    Keywords:            
-------------------------+--------------------------------------------------

Comment(by andy):

 Replying to [comment:3 filosofo]:
 >  * It's not obvious why the "Interface" of the particular object types
 is also the "factory."

 It was my first time identifying the factory pattern. I am quite sure that
 my patch can be improved here.

 >  * The "Interface" should have a name that reflects its behavior and
 structure rather than what happens to be the source of the data, in this
 case a database "row."  "Rows" don't usually have permalinks, dates, or
 titles.  Maybe something like "Loop_Object"?

 Loop_Object is okay. Since the purpose of the classes is to unify the
 presentation interfaces, how about Presentable?

 >  * The WP_Error object should not be one of the possible objects.  A
 WP_Error object violates the "Interface" implementation, and WP usually
 doesn't return error objects in the context of themes.

 True. When I wrote that I wanted to support wp_post::get($post_id). It's
 probably better without it.

 >  * Method names should follow the WP convention of being prefixed by
 "get_", since they get the values, not print them.
 >  * Class names should follow the WP convention of being capitalized.

 I admit I was lazy. I was coding from the edge of my seat and didn't want
 to write twice as many methods just then. I also didn't want to decide on
 "get_" and "the_", so I knew that leaving it in a known bad state would
 guarantee review. :-)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12267#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list