|
Posted by Jerry Stuckle on 12/03/07 13:15
AnrDaemon wrote:
> Greetings, Jerry Stuckle.
> In reply to Your message dated Sunday, December 2, 2007, 05:03:10,
>
>> But what I was referring to was not so much $sqlsomething or $rsomething
>> (although I do like $result, $queryNameResult or similar. I meant the
>> use of $k, $_k especially. You shouldn't start a variable name with an
>> underscore (it's generally reserved for system stuff), and it's very
>> difficult to see what you're doing in your loops with such similar names.
>
> While You partially true, I'd point to the fact that __names reserved for
> system use.
>
Right now I don't see where either one is not recommended, but I know
I've seen it someplace. Just have to find out where.
> Im using $_name variables to identify read-only temporary storages such as
> query strings ($_q typically) and resultsets ($_r, $_rc or something), which
> is used almost immediately and assigned only once. Larger code part where I
> use such names was completely fit to screen and easy to observe.
>
If it's a constant, then it should be defined as a constant. Such
naming conventions make your code much harder for anyone else to
understand.
> While I know that such short names are not allowed due to lack of meaning, I
> have this behaviour properly documented in project description.
>
It still doesn't mean the names aren't confusing. It's much better to
use meaningful names. And if something is a constant, it should be
defined as a constant.
> And it is really easy to code short names while You have mass of dealing with
> external I/O (either database, files or remote websites).
>
And it's really easy to make your code virtually unreadable by someone
else when using short names.
> Another use of _names is an internal object properties and methods, where it
> is easier to determine if that property/method is public or private/protected.
>
>
Keep all your properties private, as they should be, and you don't have
the problem.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|