Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Component/s: Questions
    • Labels:
      None
    • Testing Instructions:
      Hide

      The main thing to test is that this change does not break question import/export, either in the question bank or the lesson.

      (But note MDL-27797 which I found when I tested this.)

      Show
      The main thing to test is that this change does not break question import/export, either in the question bank or the lesson. (But note MDL-27797 which I found when I tested this.)
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      1345

      Description

      1/ globals in library files are very strongly discouraged - please use functions instead
      2/ in is not acceptable to place initialisation code into library file with PHP functions
      3/ the define("RANDOM", "random"); should have some prefix - I know no other library or module is dumb enough to do this, but it is not nice a all to have this in core code
      4/ question_register_questiontype(new question_calculated_qtype()); in the middle of function definitions is horrible - we have real plugin infrastructure in place now, there is no need to do things like this any more
      5/ the names of plugins should be always in language packs - preferable $string['pluginname'] in the corresponding lang pack - hardcoding them in get_name() is ugly
      6/ the name of the question type classes should start with qtype_xxxx and qformat_yyyy for question formats - not sure is it is not too late this
      7/ all functions in questionlib.php shoudl have prefix question (ex.:get_grade_options(), delete_attempt()) - we have only one global scope, with should not pollute it with such general function names
      8/ etc.

      The main problem here is that the whole structure of questions subsystem is very non-standard - now is the only time to fix things, we will not be able to break BC and fix sloppy designs of API in the next 10 years

        Issue Links

          Activity

          Hide
          Tim Hunt added a comment -

          Just to note that I think my question engine rewrite fixes almost all of these issues. Fingers crossed it can go into Moodle 2.1.

          Show
          Tim Hunt added a comment - Just to note that I think my question engine rewrite fixes almost all of these issues. Fingers crossed it can go into Moodle 2.1.
          Hide
          Tim Hunt added a comment -

          1, 2, 4, 5, 6 are now all fixed in the code for MDL-20636.

          3. I am planning to get rid of the constants like RANDOM, but I have not done that yet.

          7. Similarly, I'm planning to rename the remaining functions when I get a moment.

          Show
          Tim Hunt added a comment - 1, 2, 4, 5, 6 are now all fixed in the code for MDL-20636 . 3. I am planning to get rid of the constants like RANDOM, but I have not done that yet. 7. Similarly, I'm planning to rename the remaining functions when I get a moment.
          Hide
          Pierre Pichet added a comment -

          sorry bad mouse click

          Show
          Pierre Pichet added a comment - sorry bad mouse click
          Hide
          Tim Hunt added a comment -

          Sorry, I did not get to 7. Before the Moodle 2.1 release. I have created MDL-27795 to track that.

          I am about to fix 3.

          Show
          Tim Hunt added a comment - Sorry, I did not get to 7. Before the Moodle 2.1 release. I have created MDL-27795 to track that. I am about to fix 3.
          Hide
          Sam Hemelryk added a comment -

          Thanks Tim - has been integrated now.

          Show
          Sam Hemelryk added a comment - Thanks Tim - has been integrated now.
          Hide
          Sam Hemelryk added a comment -

          Tested while testing other quiz/question bugs

          Show
          Sam Hemelryk added a comment - Tested while testing other quiz/question bugs
          Hide
          Eloy Lafuente (stronk7) added a comment -

          And now this is part of Moodle 2.1beta, yay! Closing.

          Show
          Eloy Lafuente (stronk7) added a comment - And now this is part of Moodle 2.1beta, yay! Closing.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: