Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-20538

questionlib.php api review

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.1
    • 2.0
    • Questions
    • None
    • MOODLE_20_STABLE
    • MOODLE_21_STABLE
    • 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.)

    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

      Attachments

        Issue Links

          Activity

            People

              timhunt Tim Hunt
              skodak Petr Skoda
              Sam Hemelryk Sam Hemelryk
              Sam Hemelryk Sam Hemelryk
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                1/Jul/11