Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • You've built proof of your point right into your examples for the second worst variable name ever. Your renamed code is not functionally identical to the original. You've replaced $total with $payable_total when it should have been replaced by $order_total. Specifically, this:

    $total2 += $total * $taxrate;

    should translate to:

    $payable_total += $order_total * $taxrate;

    rather than

    $payable_total += $payable_total * $taxrate;

    Hence proving why numbered variables are EVIL!

    • by echo (2881) on 2004.03.08 10:01 (#29200)
      It only proves that modifying code just because you think the variable names aren't right, is wrong! If it ain't broken...

      PS: not that I think that $total2 is a good variable name!
      • Actually, it proves that you should ideally change the variable names using a tool that will change all uses of a given variable correctly. It further demonstrates that you should have a test suite which you run each time you change a variable, and roll back the changes if the test suddenly starts failing.