Hi Chris,

Thanks, and I agree with your points. In order of importance, I would rank them 2, 1, 3 as a personal preference, though.

Re: "no", I don't think it's a big deal, but "remove" (or "strip" in PHP nomenclature) is more descriptive. There are others that could be standardized in the framework, like "to" versus "as" (e.g., "toString" versus "asArray"). In this case I would say "as" is more correct, since you're presenting a copy of the data in a different form ("as" something else), but toString() has already been enshrined in the language internals of PHP, Java, etc.

There are exceptions in cases where it would be awkward, like Zend_Db_Inflector::plural(), singular(), and underscore()--although strangely enough camelize() (not camel()) is a function, and words like "singularize" and "pluralize" are used in the function descriptions. In this case, toPlural(), toSingular(), toCamel() would be better.

Anyway, that's just me being nitpicky.  :-)

-Matt

----- Original Message ----- From: "Chris Shiflett" <[EMAIL PROTECTED]>
To: "Matthew Ratzloff" <[EMAIL PROTECTED]>
Cc: "Zend Framework" <[email protected]>
Sent: Monday, October 02, 2006 12:20 PM
Subject: Re: [fw-general] Zend_Filter_Input


If I can continue to be pedantic for a moment, "noTags" and
"noPath" aren't good function names either. They should be
"removeTags" and "removePath" or something similar.

The original intent wasn't to begin strictly with a verb, although I can
see some value in that. Rather, prefixes were chosen to be:

1. Unique - With fewer prefixes and clearer organization, utility can be
easily remembered. By forcing ourselves to stick to very few prefixes,
it also guides us toward consistency.

2. Descriptive - In addition to being easy to remember, prefixes are
hopefully intuitive in the first place.

3. Short - The shorter, the better.

This gave us "is" (whitelist), "no" (blacklist), and "get" (blind).

Because methods/functions that begin with "is" traditionally return
strictly boolean (not just something that can be used as a boolean, such
as the return value of mysql_query()), "test" was added to describe the
unique utility within Zend_Filter_Input, where only valid values are
released from the cage. So, "test" is essentially the same as "is" with
one added feature.

Anyway, you can blame me for the current convention. If others would
also prefer changing "no" to a verb, maybe that's something we should
consider. I personally like it as it is.

Reply via email to