Bug #1436: Standard function names are not indicative of what they do.
| From: | danbeck at scott dot net | Date: | Fri, 21 May 1999 13:03:13 +0000 |
| Subject: | Bug #1436: Standard function names are not indicative of what they do. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-5844@lists.php.net to get a copy of this message | ||
From: danbeck@scott.net
Operating system: All
PHP version: 3.0.7
PHP Bug Type: Feature/Change Request
Bug description: Standard function names are not indicative of what they do.
This has been a beef for some time now. Many functions in PHP are not indicative of what they
actually do. Several functions names seem to be descriptive of what they do, but they are not good
function names.
For example:
AddSlashes() The name says it all... it adds slashes. BUT, why does it add slashes, what does it
add slashes to, how many times will it add slashes. Why would you want to add slashes? The
function doesn't actually give you an indication of where it might be used, only that it adds
slashes to something.
A better choice would have been something along the lines of quote_sql_str() When you first look at
it, what does it tell you it probably does? Easy, it works with a string, it has something to do
with SQL or databases and it quotes something in that string. Any database developer on the planet
would immediately come to the conclusion that this function might help them complete the task of
making sure there are no un-escaped quotes, backslashes or nulls in a string before sending it along
in a database query.
Many functions in PHP were taken from their perl or C++ counterparts and make perfect sense, but
there are a large number of custom functions that were given names that just don't tell you
much. If you are searching through the string section for a specific function that would escape
characters in a sql string, how would you find AddSlashes() without looking through each and every
function? You can't! You can't search for sql, escape or any other keywords...
Anyway, I love PHP and this is only a minor problem, but it would be nice if some of the function
names were updated with more accurate names.
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net