[wp-testers] 2.3 Nightly - Plugin Compatibility

Mark Jaquith mark.wordpress at txfx.net
Thu Aug 30 19:28:41 GMT 2007


On Aug 30, 2007, at 3:12 PM, Travis Snoozy wrote:

> Show me code that does not fall into one of the three categories I
> described when you add values to an enum. I contest that it cannot be
> done without some a priori knowledge of what the new enum value(s)  
> will
> be, but I'm open to being proven wrong. :)

I'm not saying you can code it so that it will behave flawlessly...  
obviously you can't do that without prior knowledge of the upcoming  
changes.  But you can code it so that when it fails, it fails in a  
way that doesn't expose private information.

For example:

if ( in_array($status, array('publish', 'attachment') ) {
	do_foo();
}

Instead of:

if ( $status !== 'draft' && $status !== 'future' ) {
	do_foo();
}

If you do it the first way, you'll never be surprised by what is  
caught in your net, only by what isn't caught, which I think is a  
preferable error.

--
Mark Jaquith
http://markjaquith.com/

Covered Web Services
http://coveredwebservices.com/

WordPress Ninja @ b5media Inc
http://b5media.com/




More information about the wp-testers mailing list