Re: What's wrong the __autoload()?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 12, 2008 at 9:23 PM, Robert Cummings <robert@xxxxxxxxxxxxx>
wrote:

> On Wed, 2008-03-12 at 17:05 -0500, Greg Donald wrote:
> > /me points to SPL and laughs his ass off
>
> I don't use SPL.


i do.

it makes handling recursion and a number of other tasks a breeze.  not
liking it because the identifier names are too long is silly (greg).  get an
editor w/ code completion if its that big of an issue for you.  o wow, my
identifiers are smaller, that makes my language easier...  not in my book, i
actually prefer longer names for variables when the terms are easier to
understand that way.  its a technique for making code self documenting, and
if i were a ruby programmer i would use it there as well.  there is a
balance that needs to be struck for any highly successful api, obviously
shorter names can be a bit easier to remember, at least to remember what the
names are, but if RecursiveIteratorIterator were RII, i would probly be like
RII, hmm.., i remember the name but not what its for; so id still end up
going back to the manual every time any way.  the best apis are ones that
are so consistent and pragmatic, client developers can remember most of it
w/o going back to the manual and that includes identifiers, their respective
parameter signatures and the semantics.  i would venture to say that where
spl has some long identifiers for class names (which i dont consider an
issue) the api is much more consistent than the standard php api, so in all
i consider it better than the standard api.

the standard api inverts arguments for example in array functions.  if all
of these functions took an array as the first argument, i wouldnt have to
check the docs every time or switch the argument order after the script
blows up the first time.  also there are multiple naming conventions used as
you can see, using underscores, abbreviating / smashing into one complete
term, and camel case (which does appear to be almost exclusively for classes
[so thats not so bad]).  its not the end of the world, but its also not
consistent like spl.  i know spl is much younger than php itself so the
evolution of its api has not been drawn out over many years.  thats probly
one reason why the standard api is a bit inconsistent, but for w/e reason
there it is.  the spl api is cleaner than the standard one.

int *array_push* ( array &$array , mixed $var [, mixed $... ] )
bool *in_array* ( mixed $needle , array $haystack [, bool $strict ] )

string *bcadd* ( string $left_operand , string $right_operand [, int $scale] )
*DOMCharacterData->appendData()*look at string functions for more examples
if you want (http://www.php.net/manual/en/ref.strings.php)

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux