7 ms·
I'll take a long function name over an incomprehensible one any day.
by AlexanderDhoore 13y ago
I'll take a long function name over an incomprehensible one any day.
- meritt 13y agoGiven that many of PHP's method names are that way due to mirroring C (and others due to the hash table hackery), I think you'd just be much happier in a different language.
- dubcanada 13y agoThe function names come mostly from C, so it's not really PHP's fault.
- rafekett 13y agoIt _is_ their fault, for repeating the stupid mistakes that Kernighan, Ritchie, et al made when designing Unix and C.
- pdog 13y agoShort names weren't really a mistake when K&R made them.
- rafekett 13y agoYes, for some time (the dark ages I like to think) programmers had to sacrifice productivity to make things faster, or to make them fit in memory. The original C compiler had a 6 character limit on variable names, leading to abominations like `strstr()`. Fortunately, by the Pentium era, which was when PHP was designed, those times were long gone. "X made this design decision before us" is never a good justification for any design decision unless the decision is truly arbitrary (i.e., are arrays 0 or 1 indexed?) -- then it might be better to stick to what's more familiar. If it was a good design decision then, then there must have been some reason at the time that should be true now to give a good case for repeating a design decision.
- Crito 13y agoI find the juxtaposition between PHP's short function names taken from C, and things like T_PAAMAYIM_NEKUDOTAYIM to be rather funny.
- e-tron 13y agorecently(not quite) there was a talk in php internals about changing that. read this: http://philsturgeon.co.uk/blog/2013/09/t-paamayim-nekudotayim-v-sanity http://philsturgeon.co.uk/blog/2013/09/t-paamayim-nekudotayi...
- Crito 13y agoWell, so long as they don't fix the parsing of octal int literals that is okay. Loosing both of my favourite offhand complaints would be rather disappointing. ;)
- userbinator 13y agoNever seen that one, but I think it's cute.
- gizmo 13y agoExpanding abbreviations doesn't improve clarity. E.g. XMLHttpRequest vs ExtensibleMarkupLanguageHypertextTransferProtocolRequest and ftp_ssl_connect vs FileTransferProtocol_SecureSocketLayer_Connect or if you want to get really ridiculous: MysqlndUhConnection::sslSet becomes MyStructuredQueryLanguageNativeDriverUserHandlerConnection::SecureSocketLayerSet
- stevejohnson 13y agoYou're misrepresenting his position pretty badly. XMLHttpRequest is a comprehensible name. "MysqlndUhConnection" much less so. Not being very familiar with PHP, I don't have any pet examples of inconsistent names to offer corrections for that might correspond with what he's actually talking about.
- camus2 13y agoyeah , some people think it's easy to understand what strstr does...
- userbinator 13y ago...like everyone who has learned C or its derivatives. It's just part of the vocabulary of the language. You could as well ask "what's a list comprehension" in Python, for example.
- mzl 13y agoSet comprehension is a standard mathematical term (http://en.wikipedia.org/wiki/Set-builder_notation http://en.wikipedia.org/wiki/Set-builder_notation). List comprehension is a fairly natural name given that.
- 1qaz2wsx3edc 13y agoWhile you're at it why don't you fix: (needle, haystack), (haystack, needle)? :P
- Domenic_S 13y agoWith array functions, the needle is first. With string functions, the haystack is first. https://gist.github.com/salathe/1672543 https://gist.github.com/salathe/1672543
- 1qaz2wsx3edc 13y agoThis still doesn't convince me it was ever a beneficial design.
- Domenic_S 13y agoI didn't claim it was beneficial, just consistent.
- turbo_pax 13y agoAre you sure it's that consistent? I just feel like there's some function hiding somewhere that breaks this rule.
- e-tron 13y agoOr even use a proper IDE to code other than gedit/notepad !!