> Me too (tm)!  This is a job for a good editor, with automatic name
> completion or abbreviation expansion.  This gives you the convenience of
> shortcuts when coding, together with the full standard names when reading
> the source code at a later date!

I think we've missed the point of my original question. Not that a
discussion of good coding principles isn't welcome, but at the same time,
there can be valid (if subjective) reasons for using shorthand functions in
the way I mentioned in my original post.

My valid reason is that I have RSI. To help alleviate that, I have a small
handful of functions I commonly use many times over defined in a way that
means less keystrokes. Across the scope of a project, that can mean
significantly less typing, and marginally less discomfort. My hands thank me
every time I use these shorthand functions.

That having been said, and purist principles aside for the moment, I doubt
there's an intermediate to advanced coder on this list who isn't comfortable
with exploring include files to find out what a function does or how a class
operates. I doubt half-a-dozen shorthand functions in that include file
would place a measurable strain on the readability or maintainability of a
project. 

Yes, I'm sure we can all generate extreme examples of code rendered utterly
turgid and obscure by random and wholesale shorthand transformation. But
let's be honest, you can make any suggestion or process seem ridiculous by
rendering it in the extreme.

The core PHP language is not without it's own shorthand approaches. Witness
the ternary operator. At a glance, it's probably not obvious what it's doing
when first viewed by someone new to PHP. Also witness the deprecation of
variables such as $HTTP_GET_VARS in favour of $_GET etc. Or the .=
concatenation assignment operator as a shorthand to $var = $var . ' added
string.' Or the echo shorthand of <?=$var?>.

My point being, the most purist coder is almost certainly using shorthand
methods built into the language. To suggest that these shorthand methods
should never be extended, when approached sensibly and for good reasons,
seems not only regressive, but also somewhat blind to the reality of the
language itself.

Of course, I realize this is a difficult position to defend. I understand
that, in theory, using shorthand functions in this way is 'wrong.' But,
after all, life is about compromise. Sometimes we get to choose the
compromises we make, sometimes we don't. More power to those who struggle
against compromise in this issue. You are a beacon of sanity and reason to
us all.

Back to the intent rather than the form of my original question: what are
the code snippets you can't live without?

Much warmth,

Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
One quirky comment at a time.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to