Re: Re: Inspiration for a Tombstone.

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

 



On Sat, Jun 28, 2008 at 1:33 PM, Jim Lucas <lists@xxxxxxxxx> wrote:
> Robert Cummings wrote:
>>
>> On Sat, 2008-06-28 at 11:27 -0400, Andrew Ballard wrote:
>>>
>>> On Sat, Jun 28, 2008 at 9:44 AM, Colin Guthrie <gmane@xxxxxxxxxxxxxx>
>>> wrote:
>>>>
>>>> Robert Cummings wrote:
>>>>>
>>>>> I will never do it... it looks ugly,
>>>>
>>>> Only if you're not used to it. IMO this is how it should be taught in
>>>> all
>>>> the books and guides etc. If that was the case, the other way round
>>>> would be
>>>> ugly :)
>>>>
>>>>> especially when performing multiple
>>>>> if comparisons on the variable.
>>>>
>>>> Perhaps, but it's still not as ugly as a hideous error gone undetected
>>>> which
>>>> accidentally deletes all your customers' data.
>>>
>>> ---snip---
>>>
>>>
>>> I don't know about "ugly," but I agree it "feels" wrong. I feel like
>>> I'm using Yoda-speak when reading code like that:
>>>
>>> If 'yes' is you_can_read_this, 'Stop standing on me' I say.
>>>
>>> or
>>>
>>> If 0 is my_pulse then 'dead you are' should say you.
>>
>> *lol* Exactly... just doesn't sit right.
>>
>> It's a good way to make sure you're not screwing up, but testing should
>> take care of that too.
>>
>> Cheers,
>> Rob.
>
> But whoever said the flow of the English language was all that efficient?  I
> actually prefer 'Yoda Speak'.  Takes less to say more.
>

Say anything about efficiency never did I. :-) I was merely commenting
on a personal preference based largely on my perspective as a native
speaker of (US) English. Now - if I WERE to address efficiency, I
don't find "Yoda speak" to be any more efficient. It's usually the
same words just in a different order. What's more that order, while
quite natural for some languages, is not natural to me at all. As Bob
mentioned, it requires a little extra thought for my brain to push
certain phrases onto the mental stack before I can pop them off in an
order that "makes sense." In programming terms, any code that requires
the same amount of statements but requires more cycles to process is
not what I would consider more efficient.

As far as the programming practice that Colin was advocating, it is
not a bad habit. And as far as the computer is concerned, the
efficiency is a wash since the number of internal steps probably
doesn't change much. However, it doesn't always work. (I know - no one
claimed it did.)

<?php
if ($challenge_password_hash = $stored_password_hash) {
    echo 'Welcome to the club!';
} else {
    echo 'Stay out! This club is for members only!';
}
?>

Andrew

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


[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