09 November 2011

Can Choice Be Correct If Error Raised? (9401)

The 7 November quiz tested your knowledge of the fact that this statement:
will drop both the package specification and body.

Several players complained that we marked this choice as correct :

As one person wrote: "If you drop the a package and then try to drop the package body, you get the error ORA-04043: object PLCH_PKG does not exist. Answer 8571 is NOT correct."

One person even went so as to say: "I really don't like to have the solution DROP PACKAGE plch_pkg / DROP PACKAGE BODY plch_pkg / scored as correct. Yes the correct outcome is shown, BUT it is definitely bad style. And knowing that an error will pop up made me not choosing this answer, so I'm blamed again for good style. I know that you will not rescore the answer. But this kind of scoring makes me think to withdraw from the PL/SQL Challenge. So please harden your choices to support good style as well."

I must admit to being a little taken aback by these responses. Let's first address the "correctness" issue and then move on to what we should and should not include as correct choices in future quizzes.

This choice was marked correct because we asked this:

Which of the choices will result in the following two lines being displayed? [after calling a stored procedure that shows the status of the specified database object]
It is, without doubt, true that if you run the two DROP statements above (a) those two lines of text will be displayed (so I don't see why a rescoring should be done), as both spec and body are gone, and (b) the second statement will result in Oracle throwing this error:
ORA-04043: object string does not exist
    Cause: An object name was specified that was not recognized by the system.
Now, as noted above, the text will be displayed as required, so I do not think that any changes to the scoring should be performed.

But should I not include such choices in the quiz? And if I do, should I always mark them as incorrect because they are "bad code"?

Certainly, it needs to be very clear that the second statement is unnecessary and will throw the error. More generally, we should provide strong recommendations against using a certain approach if it is problematic in some way.

But never include choices like this marked as "correct"? I just don't see why we would exclude such things. There is usually some sort of lesson to be learned, some way to help you reflect on the way you do your work, and the kinds of traps you can fall into.

In this case,  for example, I could see a developer who wasn't clear on the concept that DROP PACKAGE drops the body put such statements in their clean-up scripts. They might never have noticed that errors were being raised, because the end result met their requirements: packages all gone.

So they would in this case have marked that choice as correct, but then learned from reading the explanation that it is not necessary and should therefore be removed. Lesson learned.

What are your thoughts?

Grandpa Steven


  1. We have had a slightly similar discussion in a previous blogentry on error log table. So when I saw this choice I said to myself: "I'll bet there will be objections to this ;-)"

    I did consider that you would get an error by drop package body after having done drop package. But even if unnecessary, you *would* get the desired output, so I marked the choice correct (even if not best practice :-)

    I vote for keeping the scoring as is in this case. The question clearly asks for some specific output - it does *not* ask that an answer has to run without error in order to get to that output.

  2. I heartily congratulate you with your new status!
    Let me wish to new member of your family good health and appetite and to be as smart and clever as other his ancestors! =)
    Warmly yours, macabre.

  3. I am with you Steven. If the question stated "without errors", or "In the fewest statements" it would be incorrect. But "correctness" was conditioned on "do you see the results wanted".

  4. I also agree with you, Steven. If people review the correct answer and the accompanying notes, there's no reason they should be learning bad practices. And if we have to start evaluating the "style" of each option, these quizzes will get unnecessarily complicated and subjective.

  5. To follow up on Steven's comment, I think that in order for the quiz taker to understand that it is a bad practice, the quiz should be engineered so that the answer is incorrect, not correct. This is fare more likely to draw attention to those who assumed they answered correctly.

    For example, the quiz could have said that the statements were executed in a script with the WHENEVER SQLERROR clause set to EXIT or CONTINUE. Those who thought it would have been correct would have gotten it wrong.

  6. Hello Steven, All,

    Looking once again at the quiz text, maybe the only thing that could have been causing ambiguity was the wording of the question as:

    Which of the choices will result in the following two lines being displayed?
    [End of Quote]

    Maybe it could have been better to ask:

    "Which of the choices will result in the following two lines being displayed when executing the following block after the
    statement(s) in the choice ?"

    It is practically the same thing.

    I don't think there is any reason to consider
    "a priori" a choice that produces an error
    as being automatically incorrect, regardless of whether that error is trapped in an exception handler or let to propagate unhandled, as long
    as it is clear what is being asked.

    In this case, the question was about the output
    of the pl/sql block (only), and not about the output of the code that was preceding it.

    At my work for example, it is "current practice"
    ( I won't say definitely and necessarily good )
    to always execute DDL statements from PL/SQL blocks using native dynamic SQL along with
    conditional checks, not just bypassing irrelevant errors, while deploying large database and application upgrades, and this just with the purpose to avoid seeing errors where they are irrelevant, like DROPPING a non-existent table before creating it, a.s.o. ).

    Of course, the DROP statements in the quiz could have also been included in PL/SQL blocks,
    but I think this would have only added to the "verbosity" of the choices, which were otherwise very clear.

    Thanks & Best Regards,
    Iudith Mentzel

  7. I agree with you about not rescoring, even if the the second mail was written by me. What I was asking for is to have choices that will show bad code. In this special case for example it would be Ok to drop the body first and then the package even if that is still bad code, but without any errors. You could also have the complete example within one block that would make the choice incorrect.
    I tend to not look into the library if I have 100%, so I would never find out if I have picked some bad code.
    So what I'm asking for is simply to build choices that show bad coding styles in a clear and proper way.
    I always have the learning effect when going back to the library to find out why I'm not at 100%.

  8. You suggest that any "bad coding style" choice(and, I assume by extension, sub-optimal algorithms; that is, anything that is not the BEST choice) should always be marked incorrect.

    This would mean, it seems to me, that just about every quiz will be "only one right".

    I don't think I would want to do this or that it would improve the quiz playing experience.

  9. Create a new "mark" - "correct but bad".

  10. Hello al0, all-the-others,

    ... just a natural continuation of the last sentence of al0 above :

    This is pretty the same thing that I have suggested several times ... weighted choices,
    with weighted scoring ... to simply allow best-practices choices to score higher, at least
    for quizzes where this aspect is very outstanding, that is, some specific choice(s)
    are far better than other one(s).

    Of course, this introduces a certain degree of subjectivity in establishing the weights, but this SHOULD DEFINITELY and ULTIMATELY be a common decision of both the quiz author and all the reviewers, or even of each of them "voting" individually.

    Thanks & Best Regards,
    Iudith Mentzel

  11. I like al0's idea and have added it to our ER list.

    I don't really like, however, the idea of making the scoring algorithm more complex. A choice is either correct or incorrect, in the context of the question.

    Notifying players when they review answers that a choice is correct, but not the best, through a visual cue, seems to me to be sufficiently helpful. We don't need to weight the choice to be scored differently.

    If we want to give "weight" to an optimal choice, then I think everyone will be better off by simply designing the question to ask for the best solution.

  12. Hello Steven,

    Yes, designing a quiz to ask for the best solution could be also an option, but this demands making the quiz necessarily a "single correct choice" quiz.

    Otherwise, a question of "which one is the best ?" cannot be answered by YES/NO marking.

    Of course, marking the "correct but bad" is always welcome, though this was in fact always done either in the answers of the choices themselves or in the overall answer when the quiz required it.

    Thanks & Best Regards,

  13. Not including poorly-written code means no chance to discuss it.

    To everyone who disagrees, please let me know where you work so that I can apply. (sarcasm)I am sure that NONE of the code in your production systems includes anything that could be shown to the developer with the comment, "Yes, I know it works, but..." (/sarcasm)

    It is written on my whiteboard, "I take the Challenge to learn."