in reply to WitchTest - A Tool For Determining If A Woman Is Guilty Of Witchcraft

Scripting problems:

1/ Always use strictures (use strict; use warnings;).

2/ $suspectedWitch is assigned a value which is never used.

3/ Initializing $witchStatus is redundant. All following paths replace the value.

4/ The if ($ARGV[0]) is redundant - both branches of the if perform the same task.

5/ if ($witchStatus) is redundant - $witchStatus is always true.

6/ No test is made to determine that a name has actually been passed on the command line.

7/ Dates are better given using one of the ISO time/date formats to avoid confusion.


True laziness is hard work

Replies are listed 'Best First'.
Re^2: WitchTest - A Tool For Determining If A Woman Is Guilty Of Witchcraft
by Jenda (Abbot) on Jul 01, 2009 at 23:14 UTC
    1. If you used the strict definition of witchcraft, you'd never get to burn anyone.
    2. suspected witches tended to give a lot of information that was never used.
    3. wondering whether a suspect is a witch is pointless, the answer is always yes.
    4. "Tie her up and throw her into the lake. If she drowns, the God did not want her to live because she was a witch. If she doesn't drown, she was using her dark powers and therefore is a witch and has to be burned."
    5. see 3.
    6. Who cares who's that? Burn her! She's a witch!

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.

      1) I thought about going above and beyond the 1692 Salem spec, but didn't want to confuse the matter. This is also why I omitted any reason for trial. I'd imagine these trials would have been thrown out in Appeals, anyway. Hearsay isn't evidence.

      2) True. I wanted to cut to the chase, however..If a witch is a true witch, then the code works. If the witch is not a witch, but accused by virtue of being named in @ARGV[0], then, she might just as well be a witch, and therefore the code works. She must be burned.

      3) Absolutely. I felt it important to go ahead and perform the test for reasons of code readibility, however. Conditional statements can be tricky, and being so explicit prevents a witch from tampering with the code.

      4) Much like the drowning test for witches, algorithmic simplicity is a goal I try to strive for as well. I omitted any drowning test subroutines, which, I admit, does deviate slightly from the 1692 Salem spec, but I'm not aware of any direct evidence of drowning test.

      5) Saw it, and agree!

      6) I agree. All women who's named are subjected to this test must be witches, by mere virtue of needing to BE tested. My code is algorithmically perfect. We all know witches are a problem these days, and burning at the stake has gone somewhat out of fashion.. I hope to reverse these trends, as I oppose witches and witchcraft of any form. Being such brings me into favor with God, and ensures my next year's crops will be plentiful.
      I think your point 3 is the essence of the original code. It's hidden in what appears, on the surface, to be a legitimate test.

      I think most of the downvoters of that post must have missed that.

Re^2: WitchTest - A Tool For Determining If A Woman Is Guilty Of Witchcraft
by JavaFan (Canon) on Jul 02, 2009 at 09:18 UTC
    1/ Always use strictures (use strict; use warnings;).
    Actually, in this case, adding warnings would make the program spit out a warning if run without arguments. But it's arguable that the program is actually doing the right thing. It's a sign of a newbie to assume that slapping 'use strict' and/or 'use warnings' on a program magically increases the quality of the program - wearing seatbelts doesn't make you a better driver either. And note that slapping 'use strict' on this correct program actually prevents it from compiling. Doesn't seem like an improvement to me.
    2/ $suspectedWitch is assigned a value which is never used.
    Maybe you see a different program than I do, but I see $suspectedWitch being used in the print statements.
    6/ No test is made to determine that a name has actually been passed on the command line.
    In my universe if ($ARGV[0]) won't be true if there's nothing on the command line.
    7/ Dates are better given using one of the ISO time/date formats to avoid confusion.
    Not of course in the case of the Salem witch hunt. The ISO standard is a standard about the Gregorian calendar. But the colonies were still on a Julian calendar by 1692.

    And after 7 points, you still fail to spot the non lexical variables.

Re^2: WitchTest - A Tool For Determining If A Woman Is Guilty Of Witchcraft
by bpoag (Monk) on Jul 01, 2009 at 23:39 UTC
    The only thing I forgot to do is include a Perl module that gives people a sense of humor... Jesus..
      That something a witch would say, burn him, buuuuuuuuurn him ;p