Re: Re: Switch - Case Statement Questions

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

 



On Sat, Nov 17, 2012 at 3:13 PM, Sebastian Krebs <krebs.seb@xxxxxxxxx> wrote:
> 2012/11/17 Andrew Ballard <aballard@xxxxxxxxx>
>
>> On Nov 16, 2012 10:24 PM, "tamouse mailing lists" <tamouse.lists@xxxxxxxxx>
>> wrote:
>> > Just a tad obscure for someone coming along
>> > later
>>
>> Without knowing the intent of the code, it could be a headache to maintain.
>>
> Interesting, that you see 5 lines of code and assume, that nobody will ever
> get the intent of this code ;) Of course the context is missing. I guess,
> that "$count" is something like "remaining days", or such, because "7" and
> "14" look like "one week" and "two weeks", respectively. Thus I wouldn't
> name the variable "$count" [1], but "$remainingDays" and voila: Context is
> back and so is the intent :)

This was actually the thrust of my remark about obscurity. I could
easily see how the refactored algorithm worked from the original
code's algorithm. What was obscure was exactly the variable name
$count, i.e., the meaning of the data driving the algorithm. When you
know the actual meaning of data being used, the obscurity goes away.
Hence: useful variable names.

Again, well done, Seb.

-- 
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