20 November 2010

Players don't like "execution section" in 19 November quiz (1663)

In the 19 November quiz regarding RETURN statements, many players objected to our scoring as incorrect the following statement: "A RETURN statement can only be executed from within an execution section." We said this is incorrect because you can also have a RETURN statement in the exception section of a block. There were two objections to this scoring: 1. The term "execution section" is not found in the Oracle documentation. Instead, the term "executable part" is used. Thus, the question was ambiguous and should be re-scored. Here is a "typical" comment from a player on this point: "The November 19 quiz used the phrase "execution section." A search of the 10gR2 documentation on the OTN site for that phrase does not return any hits, which indicates that "execution section" is not a defined Oracle concept. The phrase "execution section" is ambiguous since it lacks a definition that would preclude one from inferring an intent to separate code into executable (i.e., procedural) and non-executable (i.e., declarative) portions." 2. The "executable part" of a block includes the "exception handling part" of a block, since Oracle documentation states in Understanding Block Structure: "A PL/SQL block has three basic parts: a declarative part (DECLARE), an executable part (BEGIN .. END), and an exception-handling (EXCEPTION) part that handles error conditions." Several players concluded that since the executable part goes through the END; statement, it includes the exception section. And so this choice should have been scored as correct. I will address these separately. First: "Execution Section" is not a defined term I was very surprised to see this response. Yes, these players are correct. In the documentation, the only part of the block that is required is referred to as the "executable part." It is, however, very hard for me to accept that you would not read the term "execution section" and see that it refers to the very same part of the block. After all, if I said to you "look at the statements in the declaration section," I do not think you would say "What's that? I only know about the 'declarative part.'" (which is how Oracle, in this same part of the documentation refers to the, um, declaration section. It I talked to you about the "exception section" would you interrupt me with a correction: "Sorry, Steven, there is no such thing. There is, however, something called the 'exception-handling part.'?" I do not believe that using the word "section" instead of "part" should cause a problem in understanding. I also do not see how using "execution" instead of "executable" would lead to confusion. Furthermore, a quick search on the Internet for "PL/SQL execution section" shows several hits, all showing references to this "executable part" as the "execution section." My impression is that those who objected to the term "execution section" were wrestling with the question of whether or not it is acceptable to consider the exception section to be part of the execution section. So then you looked for a definition of the term "execution section" in the Oracle documentation, could not find it, and then raised an objection about that. Exception Section part of Execution Section? In the Block Declaration section of the 10g PL/SQL Users Guide and Reference, we find: "The basic program unit in PL/SQL is the block. A PL/SQL block is defined by the keywords DECLARE, BEGIN, EXCEPTION, and END. These keywords partition the block into a declarative part, an executable part, and an exception-handling part.." The definition of a procedure states: "The procedure body has three parts: an optional declarative part, an executable part, and an optional exception-handling part. The declarative part contains declarations of types, cursors, constants, variables, exceptions, and subprograms. These items are local and cease to exist when you exit the procedure. The executable part contains statements that assign values, control execution, and manipulate Oracle data. The exception-handling part contains handlers that deal with exceptions raised during execution." In the most completely elaborated description I could find (About Subprogram Structure of the 11g 2 day Developer's Guide), you will see the following: The structure of a procedure is:
PROCEDURE name [ ( parameter_list ) ]
 { IS | AS }
   [ declarative_part ]
 BEGIN  -- executable part begins
   statement; [ statement; ]...
 [ EXCEPTION -- executable part ends, exception-handling part begins]
   exception_handler; [ exception_handler; ]... ]
 END; /* exception-handling part ends if it exists;
         otherwise, executable part ends */
I suppose you could argue that it is unfair to look at 11g documentation, but this question has to do with establishing a reasonable understanding of terminology and use. It seems pretty clear to me that Oracle's intention is that the exception section (the "exception-handling part") is considered separate from the execution section (the "executable part"). Yes, some parts of the documentation mention that the execution section is between BEGIN and END, but in all the paragraphs where that appears, Oracle also clearly distinguishes between the "executable part" and the "exception-handling part." Clearly, Oracle considers these to be distinct parts or sections of the block. As noted above, I also believe it is entirely reasonable to expect a PL/SQL developer to "equate" the following terms:
  • "declaratitive part" and "declaration section"
  • "executable part" and "execution section:
  • "exception-handling part" and "exception section"
So I do not believe there is any need to re-score this quiz. I can understand the frustration you experience with both my quizzes and Oracle documentation. I have never before realized just how "fuzzy" the "logic" is in the documentation when it comes to clearly defining terms. Partly and precisely because of that, however, we have to rely on reasonable interpretations of phrases. I believe in the case of this quiz, my terminology should be acceptable and understood clearly enough. OK, players, time to blast away. SF

27 comments:

  1. I understood perfectly what you meant. Section, part, area, portion or segment -- those are all synonymous, no matter what the official documentation might call it.

    My own beef is with the guy in the number one spot who allegedly finished the quiz in 4 seconds -- I don't think it's fair for Superman (or maybe Flash?) to use his super-speed in a public competition. ;-)

    Will there be a way to see the revised rankings after you apply your anti-cheating algorithms?

    ReplyDelete
  2. As I state in the FAQ:

    "It is certainly quite possible that a person answering so quickly (and correctly) is cheating by taking the quiz under a different account, figuring out the correct answers, and then submitting the answer under their "real" account. It is also possible that they knew that subject very well or simply guessed. Rather than automatically reject such answers, we analyze player patterns over a longer period of time, usually no less than two weeks. We then make adjustments to the timings and ranks of those players who answer, cumulatively, in so short an amount of time that there is no way to distinguish their pattern of play from someone who would be cheating. Bottom line: Don't get mad if you see a very fast answer. Chances are, justice is just around the corner."

    After I apply adjustments, rankings are updated and you certainly see the impact.

    Perhaps I will enhance my adjustments to "knock out" the obvious, egregious offenders earlier...

    SF

    ReplyDelete
  3. I don't want a rescore, but I disagree with the premise here.

    My understanding is a little more simple. A block has two parts: a part that has declarations, and a part that has executable code. The executable part may have an exception handler, but surely no-one would argue that it is not executable. If an exception is raised, the appropriate exception handler *will* be executed.

    To my mind, an exception handler is "an execution section", according to the straightforward meaning of those terms.

    ReplyDelete
  4. And while I understand your reasoning, Jeff, I don't think it is supported by the way Oracle presents the sections of a block.

    Couldn't you also extend your reasoning to conclude that the declaration section is also an "execution section", since if a declaration specified a default, that code will be "executed"?

    ReplyDelete
  5. I'd like to post about the 2nd question rather. I don't see the proof in the code since the 'no_return' function does include at least a RETURN statement...
    Thanks
    Anne

    ReplyDelete
  6. I agree with Jeff Kemp. Declaration section first and foremost allocates memory and, well, declares (something), some execution as a result of "default" values is merely a nice bonus to this; the exception handler executes code and thus, by common sense, is subpart of execution section.

    Well, common sense - we shouldn't count on it, I guess. ;-)

    It would be nice if future quizzes wouldn't rely on such loose terms.

    ReplyDelete
  7. Hi Steven,

    I don't envy you.

    In its courses Oracle is unambiguous: the exception section is separate from the executable section.

    Regards,
    Piet

    ReplyDelete
  8. Hello Steven,

    I am rather with Jeff - but believe that the quiz badly needs rescoring. It was more about terminology juggling then about a real PL/SQL knowledge. Especially if take into account that this "executable section"/"exception section" separation is completely artificial and is not present in any other modern programming language that I know of (ADA is not modern).

    Regards,
    Oleksandr

    ReplyDelete
  9. The fact that only 51% of the participants responded "correctly" to the "execution section" choice indicates that this choice is ambiguous (it seems unlikely that 49% of the respondents thought that the RETURN statement can appear in declarative code). While it is reasonable to expect that players would treat the phrases "execution part" and "execution section" as synonymous, it is equally reasonable to expect players to interpret the use of "execution section" as a deliberate attempt to express a concept of executable code that is more inclusive than Oracle’s use of "execution part." Oracle® Database PL/SQL User's Guide and Reference 10g Release 2 consistently uses "execution part" to refer only to executable code that is not in the exception part, but never uses the phrase "execution section."

    In your post you state, "Yes, some parts of the documentation mention that the execution section is between BEGIN and END, but in all the paragraphs where that appears, Oracle also clearly distinguishes between the 'executable part' and the 'exception-handling part.'" Instead of supporting your argument that "execution section" and "execution part" should have been understood as synonymous, this statement demonstrates that the two phrases can have differing meanings.

    ReplyDelete
  10. I am one of those players who spent some time figuring out if the exception handling part could be considered an execution section and eventually decided favorably. My reasoning was that: a) exception handlers are purposefully used to execute code, albeit in exceptional conditions; and b) one can declare anonymous blocks inside other blocks to have finer control over exceptions, and do so having into account the surrounding executable code.

    I understand the distinction between the declarative, executable, and exception handling parts, but I would argue that there is more to exception handling than just propagating exceptions (in conceptual terms), and, indeed, having a return statement there implies a logical connection with the executable part of some other block.

    ReplyDelete
  11. I opt to see this from the angle of "what should not have happened". I believe that everybody can agree that "execution" translates into whatever the business is about. When something goes wrong with the business (or the data used by the business) we raise an exception. Oracle calls this an "exception" and I'm sure the business has an equivalent term.

    How do you all format your PL/SQL blocks?
    I learned it this way, I agree with it, and all IDE'S I know of do too:
    DECLARE
    -- this is what we need to work with
    BEGIN
    -- make business happen
    EXCEPTION
    -- something did not work
    END;

    To me, this clearly identifies Execution and Exception as two distinct areas.

    I do not see how the wording of this quiz can be confusing. Rather, it uses common terms (one way or the other) that any PL/SQL developer should be familiar with.

    Above all, I do not believe that Steven is eager to trick anybody! Instead, common sense should prevail. If an issue occurs before the EXCEPTION, I would look to our business rules. If it happens after EXCEPTION, I would look to improve our error handling (after checking that the business rule is ok). Either way, I am looking at two very distinct areas of my program.

    Mike

    ReplyDelete
  12. I'm also not convinced by the exclusion of the exception section from the 'executable' section, but it does match the those extracts from the documentation, so I'll concede.

    I think the mental hurdle comes from trying to match the BEGIN to the END. If we think EXECUTE rather than BEGIN, then it follows better, and we match the END to include the declaration section too. That is cleaner as, with a named block, the label you should use in the END statement is the one in the PROCEDURE/FUNCTION or in the <<>> preceding the DECLARE.

    ReplyDelete
  13. I also wrestled with what is the concept of the question? And (unfortunately) I finally decided, the question was can you use RETURN someplace other than where execution happens. Since I saw the possibility of ambiguity in my interpretation I then went to the documentation just in case. Since I couldn't find the phrase "execution section" I took that as confirmation I must have read it correctly. I didn't really even see the use of the word "part" until later; but then it was too late.

    ReplyDelete
  14. I must say that I am surprised at this discussion. First, I am sure you all know that I am ready, willing and able to admit I made a mistake and issue a correction. Second, I find myself wondering (at 6 AM on Sunday, as I get ready to head over to Terminal 3 and head home from my last trip of the year) if I have inadvertently cultivated an environment on the PL/SQL Challenge that leads players to be constantly suspicious that I might be trying to "trick" them.

    I say all of this because even after all these comments, and many by some of the higher scoring players and very serious PL/SQL developers, I simply cannot see the validity of your objections. In all my years working with PL/SQL, I have always talked about the three different sections of a PL/SQL block. It has always been presented by Oracle as three different parts or sections. I have never once in all this time ever heard anyone voice the opinion that the exception section is a part of the execution section (or executable part, if you will). The only justification for this position from the documentation is the occasional mention of "BEGIN-END;" as a description of the execution section of the block. Yet in all those instances that I could find, Oracle makes it quite clear that it considers the execution part to be different from the execution part. That is, the "BEGIN-END;" is simply shorthand for saying "The execution section starts with BEGIN and ends with END, unless there is an exception section, in which case the execution section ends with END".

    This perspective is, in fact and as I noted in my initial post, made explicit in the 11g documentation.

    I definitely cannot accept a % of wrong answers as an indication of ambiguity, as jhall62 suggest I should do. It's possible you are right, that many, many developers were confused by this - but how can we know?

    And as for arguments of common sense, well, I would argue first that common sense leads us clearly to a belief that the exception section is distinct from, not included within, the execution section. Then I would acknowledge that clearly "common sense" means different things to different people.

    Some of the arguments made to justify your interpretation of "exception section within execution section" are interesting, such as "having a return statement there implies a logical connection with the executable part of some other block." Yet such an interpretation is simply not supported, so far as I can tell, by any of the (sometimes fuzzy) verbiage in the documentation. That is, you can interpret all you want, and sometimes those interpretations will be helpful in how you view and build your code, but when it comes to an understanding of the different parts of a block, this is not a situation in which I find actual ambiguity, justifying a re-score.

    Shall we move on?

    ReplyDelete
  15. > that leads players to be constantly suspicious
    > that I might be trying to "trick" them
    I'd put it more positive: you want us to read your questions very thoroughly :D

    I checked the answer in question because I compared it with other programming languages I know where the exception handling block is a sub-block auf the "execution" block.

    However, that would mean that a PL/SQL block should be defined as:

    [declare ...]
    begin
    [exception
    ...
    end;]
    end;

    So, regardless how it is defined in any other "modern" language in PL/SQL the opening of a new section obviously is also the closure of the previous section.

    Also, as Steven said, only because you can "execute" something within the exception-section, you're still in the section labeled with "exception" rather than the section labeled with "execute".

    Now I understand my misinterpretation,
    let's move on!

    ReplyDelete
  16. There is a fundamental difference between using the phrase "execution section” in talks or writings in contrast to its use in this quiz: talks and writings generally contain sufficient context to establish definition but in this quiz it is an isolated expression. Although you have routinely and consistently used this phrase in your writings (e.g., Oracle PL/SQL Best Practices), that does not establish context for this quiz. By your own admission the literature on the subject has used "execution section" not only as you have used it but also to refer to everything between the BEGIN and END. This seems to be an unequivocal recognition of the ambiguity; however, you then deny that an ambiguity exists.

    Concept questions can be difficult to address in the limited space of a quiz. Unlike quizzes in formal courses, the PL/SQL Challenge is not based on assigned material that establishes the definition of terms. Had I read the portion of Oracle PL/SQL Best Practices that discusses PL/SQL block structure immediately prior to taking this quiz, I would likely have read the quiz choice with your intended meaning; however, without that basis it was necessary to guess at your intent. I suspect that your difficulty accepting that the phrase is ambiguous is based on your past use of it when describing PL/SQL blocks.

    I don’t expect you to change your position, but hope you will avoid such ambiguity in future quizzes.

    ReplyDelete
  17. Definitely we can move on. Only a few are asking for a rescore. I think the responses are specifically because we DON'T expect to be tricked. So, when we read a question in a way that makes perfect sense to us, and "correctly" choose the answer for our reading, it's sort of a double penalty to be marked wrong. Particularly when we know the concept well enough that we would have gotten it right had it been worded differently.

    I do not envy your task of trying to find totally disambiguous phrasing for every question. And while I'm disappointed that I got a question wrong on a topic I do understand I don't think its inappropriate to point out wordings and the logic that follows from them to help in future questions.

    I will admit to swearing and hand waving when I didn't see 100% for my score, but I've missed far more questions simply because I mis-clicked than because I mis-understood. My lower scores are mostly my own failings.

    So, carry on, leave this one as is and move on; but I do hope some of our responses help the questions going forward.

    Thanks again!

    ReplyDelete
  18. jhall62, just to ensure that I am not misunderstood...you write "By your own admission the literature on the subject has used "execution section" not only as you have used it but also to refer to everything between the BEGIN and END. This seems to be an unequivocal recognition of the ambiguity; however, you then deny that an ambiguity exists."

    That is NOT my admission. My "admission" is that the only possible way you could ever interpret the exception section as being part of the execution section is if by pointing to those occasional, parenthetical "BEGIN...END" phrases when mentioning the execution section.

    But - and I think I have been clear in this above - the only times you even see that much of an inference is directly in the context of a discussion of THREE, DISTINCT sections in a PL/SQL block.

    So what I am arguing, but I have clearly not been sufficiently clear about it, is that there is NO REASONABLE AMBIGUITY based on a reading of the Oracle documentation, my writings, discussions "out there" in the world, and so on.

    It's simply not the way a PL/SQL block is presented or how it is discussed.

    That's my conclusion from going over the doc, etc., in some detail. I have not seen anything from any of the writers above to contradict this, except to point to "BEGIN...END," the context of which I would argue clearly denies the ambiguity!

    Wow. This is fun or...no, I just got home from 10 hours of traveling back from Europe. I am deliriously happy to be here, and that is spilling over to the blog.

    :-)

    Yes, we will move on, and yes I will strive to avoid ambiguity and yes we will continue to experience moments like this, largely I would argue because of the ambiguities in Oracle documentation. I can't give definitions of everything I talk about in the quizzes - that would (a) give away lots of the answers and (b) create lengthy cumbersome quizzes.

    OK, time to ride my bicycle to visit my wife at Lill Street, an art center where she is displaying her jewelry.

    Fun chatting, as always!
    Steven

    ReplyDelete
  19. Hi,
    I'm one of the players who read the question... read it again... and again... and then gave some answer - because in my understanding executable part include exception handling as it include the logic usually. And I felt that I don't care about the points... but still this question was very unclear for me...

    ReplyDelete
  20. I don't usually have strong feelings about the quiz since it is just a bit of fun, but I have to agree with pierre^ and Jeff Kemp. I interpreted "execution section" as "not declaration section".
    Anyway, "bygones".
    With regard to infeasibly quick answers, I can envisage a situation where someone is pushed for time and just luckily randomly ticks a box or two before rushing off to their meeting.

    ReplyDelete
  21. I understand you're not going to change your stance on this question, and I'm fine with that, but you make so many statements about there being three DISTINCT sections (Context tells us that by this you mean that these sections/parts/places in a PL/SQL block are completely exclusive of each other)...

    If you have to pick whether you are currently in your home city, in your home (BEGINS at your front door and ENDS at your back door), or in your study/office, which of these 3 DISTINCT places exclusively describe where you are? You must not be in more than one of these places at the same time, because a more specifically defined place cannot exist with a more generally defined place...

    ReplyDelete
  22. Right. I believe that the only reasonable interpretation of Oracle documentation is that these are three distinct sections, all defined within a larger "location" (the block as a whole).

    My home contains a study, bathroom and bedroom. I can be in any one of the rooms, but not more than one at once.

    Similarly, I can be editing my block, but while I am doing that, I am either in the declaration section, execution section or exception section.

    I cannot be in two at the same time.

    SF

    ReplyDelete
  23. With all due respect, I think I have to be contrary to one of the posts above, there very much are "REASONABLE" abiguities here. This is a case where there are two viable readings; each which leads to a different answer. The examples above are phrased to coincide with a particular reading, but they are equally valid if phrased according to the other reading too.

    I have the same 3 rooms in my house. I'm not in the bedroom. Where am I?

    I'm editting my pl/sql block. I'm somewhere that code can be executed. Where am I?

    The arguments above (on both sides) are cogent and well founded. But they are based on different assumptions. Neither assumption is inherently better or worse than the other.

    When discrepencies like this happen, the quiz maker gets to decide. Lucky for some, unfortunate for others, but in the grand scheme, little impact. As I said before, most of my errors are my own, not ambiguous questions.

    So, even though I'm on the bad-end of this discussion I'm not holding a grudge about scoring but I don't think it's fair to dismiss the counter argument as unreasonable.

    ReplyDelete
  24. Sean, I very much appreciate your comment. As I wrote posts that used the term "reasonable" (and I used it more than once), I experienced a feeling of discomfort. I have been doing this long enough, that I should have recognized the warning signs and changed what/how I wrote.

    It is not very respectful to anyone (especially other software developers) to, in essence, accuse them of being unreasonable. Reason, rational thought, is at the very foundation of what we do.

    Clearly, a number of players felt there was ambiguity in my reference to "execution section." I should not, CAN not, dismiss that (even if I decide that I will not re-score :-) ). And if you experienced ambiguity, my seeming outright dismissal of ambiguity could seem like a slap in the face.

    So, dear PL/SQL Challenge players, I apologize if I offended any of you.

    ReplyDelete
  25. I'll start with - I'm not fussed over a rescore or not. It's a game ;-)

    However, when reading through your thorough analysis, I was very surprised when you came to the conclusion that you won't be rescoring, particularly when considering this phrase:

    "The execution section starts with BEGIN and ends with END, unless there is an exception section, in which case the execution section ends with END".

    When I read the question, I found myself thinking "how could you do a return in the declaration section"

    I'm happy in a way you're standing your ground, it will help with consistency in the future - but I have seen you apply a correct response for all for less.

    So would this be considered as not having a return statement within the execution section?

    begin
    << inner_block >>
    begin
    null;
    exception when others then
    return;
    end inner_block;
    end anon;

    Keep up the good work, and retain that thick skin ;-)

    ReplyDelete
  26. Oh my. What a mess I have made of things. Thanks for pointing out that sentence, Scott. That is a TYPO. I meant to say:

    That is, the "BEGIN-END;" is simply shorthand for saying "The execution section starts with BEGIN and ends with END, unless there is an exception section, in which case the execution section ends with EXCEPTION".

    Argh....

    As for your example of a nested block that contains within its exception section a RETURN, I am not sure how to respond. You seem to be implying that whenever I talk about a PL/SQL block, I should state that it does not contain any nested blocks, or that the block under discussion is not a nested block but a top-level anonymous block...and I start to despair that it will be possible to pose quizzes against a common base of understanding about the language in which we code. I'll just have to "soldier" on....

    I thought this was a rather straightforward quiz, but then I've thought that way before....

    Your statement "I'm happy in a way you're standing your ground, it will help with consistency in the future - but I have seen you apply a correct response for all for less." was simultaneously encouraging and troubling. The troubling part is that on the one hand I agree that I have applied an adjustment for less - less vigorous debate, anyway. So why don't I apply a correction?

    Here's the thing: I look at the documentation, I "look" at how I have ever thought about, talked about and taught the structure of a block, and I simply don't see the ambiguity (and I am NOT accusing anyone of being unreasonable!). I don't think I can or should rescore when players say they have experienced ambiguity but I can't see the ambiguity in the code or supporting documentation.

    Well, thanks again to everyone for your patience, for your willingness to challenge me, for accepting my decisions....onward, PL/SQL developers!

    ReplyDelete
  27. The worst thing about this matter is that it has no practical value - it will not affect the quality of your code either you consider an exception s3ection as a part of an execution section or not.

    It resembles me a very old discuss how many angels may fit on to a needle tip.

    Regards,
    Oleksandr

    ReplyDelete