Re: RE: [PHP-QA] Re: [PHP-DEV] ctype function (re?)naming

From: Date: Thu, 01 Mar 2001 05:43:25 +0000
Subject: Re: RE: [PHP-QA] Re: [PHP-DEV] ctype function (re?)naming
References: 1  Groups: php.dev php.qa 
Request: Send a blank email to php-dev+get-47702@lists.php.net to get a copy of this message
Stanislav Malyshev wrote: > RC>> read (and comprehended) more easily, so the purpose of the > RC>> function is less ambiguous. Without them, the name becomes less > Please explain how presense or absense of underscore makes name more or > less ambigious. I'm really lost here. It's more legible for the same reason that it's easier (and faster) to read "one two three" than "onetwothree". The human mind can easily tokenize at the appropriate places, when it has a token. Without a token, the string is much harder to parse. Even StudlyCaps works the same way, as the "token" is based on the letter's height. For the very same reason that I use a space bar when typing email, I use an underscore when a spacebar is inappropriate. > RC>> Much of the time I already know the function names, I just don't know > Huh? Tell me what function searches ldap database for a string without > looking in the manual? There's several, in order of use: ldap_connect, ldap_bind, ldap_search. Without looking in the manual, I _don't_ have to guess if it's ldap_search or ldapsearch. Which is my entire point. I know the ldap functions were written with a consistent "word_word_word" scheme. Other extensions don't use this, so I _do_ have to check back in a reference. > Is it ldap_search? ldap_query? Now how do you get > results? Is is ldap_get_result? ldap_fetch_result? ldap_get_row? > ldap_get_value? ldap_get_values? ldap_read? ldap_get_entries. (not ldapget_entries, not ldap_getentries, not LdapGetEntries, not LDAP_getentries...(more on case and the docs below)) > More guessing? Did you already > look in the manual? I bet you did. And underscores didn't help you. I didn't check a manual. Ldap functions aren't named in a mixed fashion of word_wordword and word_word_word. They follow the *most common* PHP syntax of using word_word_word. How having underscores helps is that I'm not guessing at whether or not "the ldap function that gets entries" is named "ldap_get_entries" or "ldap_getentries" or "ldapget_entries" or "ldapgetentries". That's the point. I have an expectation that functions will be named consistently, so I _don't_ have to RTFM each time I need to use a rarely used function. Other function families are so mixed up that I spend more time reading manuals. > So, you propose to name GD functions image_gif instead of ImageGif and > confuse all the users that were so unlucky as to have previous acquitance > with GD? Yes. Rename them, and deprecate the old ones, alias them, and remove them much later. To stop confusing the *language*, as a whole, we should be doing this with some consistency, so we're not confusing people as they try to learn new function names. They shouldn't have to guess, or read the manual, just to figure out the "proper spacing" in invoking it. Here's the current breakdown: Apache: word_word_word/wordwordword. Array: word_word_word Aspell: word_word_word BCMath: wordwordword Bzip2: wordwordword Calendar: word_word_word/wordwordword/WordWordWord COM: Calendar: word_word_word/word_wordword Classes/Objects: word_word_word ClibPDF: word_word_word/word_wordword Curl: word_word_word/word_wordword Cybercash: word_word_word Ctype: word_word_word dba: word_wordword dbm: wordwordword Directory: wordwordword DOM XML: word_word_word/word_wordword/wordwordword Errrors: word_word_word FilePro: word_wordword Filesystem: word_word_word/wordwordword FDF: word_word_word FTP: word_word_word Functions: word_word_word Gettext: wordwordword GMP: word_word_word HTTP: word_word_word/wordwordword Hyperwave: word_Word_Word/word_WordWord ICAP: word_word_word Image: WordWordWord Imap: word_word_word/word_wordword Informix: word_word_word/word_wordword Ibase: word_word_word/word_wordword Ingres: word_word_word LDAP: word_word_word mail: word_word_word math: word_word_word/wordwordword mcal: word_word_word mcrypt: word_word_word mhash: word_word_word MSSQL: word_word_word Misc: word_word_word/wordwordword mnoGoSearch: word_word_word msql: word_word_word/word_wordword mysql: word_word_word/word_wordword network: word_word_word/wordwordword ODBC: word_word_word/word_wordword Oracle 8: WordWordWord openssl: word_word_word/word_wordword Oracle: Word_WordWord ovrimos: word_word_word Output: word_word_word/word_wordword PDF: Word_word_word/word_word_word/word_wordword Verisign: word_word_word Options/Info: word_word_word/word_wordword Posix: word_wordword PostgreSQL: word_word_word/word_wordword Program Exec: wordwordword Pspell: word_word_word Readline: word_word_word Recode: word_word_word Preg: word_word_word Ereg: word_word_word Satellite: word_word_word/WordWordWord sem/shm: word_word_word SESAM: word_word_word/word_wordword Sessions: word_word_word Shmop: word_word_word SWF: word_wordword SNMP: word_word_word/wordwordword Sockets: word_word_word/wordwordword Strings: word_word_word/wordwordword Sybase: word_word_word URL: word_word_word/wordwordword Variables: word_word_word/wordwordword WDDX: word_word_word XML: word_word_word XSLT: word_word_word/word_wordword Yaz: word_word_word/word_wordword YP: word_word_word Zlib: wordwordword Ignoring case, the extension count, and the possible naming styles, is as follows: word_word_word: 65 wordwordword: 24 word_wordword: 21 Some extensions use more than one style, but the one most often used is word_word_word. Many functions fit into word_word, which is not affected one way or another by observing the most common thread in naming. The standard seems to already be in place. -Ron -- --2D426F70|759328624|00101101010000100110111101110000 Personal: ron@opus1.com, 520-326-6109, http://www.opus1.com/ron/ Work: rchmara@pnsinc.com, 520-546-8993, http://www.pnsinc.com/ The opinions expressed in this email are not necessarily those of myself, my employers, or any of the other little voices in my head.

« previous php.dev (#47702) next »