CVS edit link for HylkeVDS

Hello Reviewer,

I'm Hylke van der Schaaf. I work at Wageningen University for the group Wageningen Multimedia Research Centre (http://wmmrc.wur.nl/). I design and implement digital learning materials for various fields in the life sciences. As part of my work I develop and maintain a set of Drupal modules for the use of closed questions in education. Since there is an interest in these modules from other universities as well, I'd like to have them hosted on drupal.org.

---------------------------------

Module: ClosedQuestion
Download: http://wmmrc.wur.nl/drupal-modules/download

The Drupal module ClosedQuestion adds the Closed Question node-type to Drupal that takes an XML question definition and displays this question to users. The ClosedQuestion-nodes are stand-alone and can be used anywhere a normal node is used. For example as training questions halfway or at the end of a chapter, or as a set of questions forming a case-study that leads a student through a complex problem by asking a series of questions. The ClosedQuestion module is used by the Proteus and LinearCase modules.

Features:
* Designed for practice: students can take as many attempts as they like.
* Many feedback options, feedback can change with number of attempts or specific answers.
* Many question types.

Comparison with Quiz:
Quiz is made for quizzes. This makes Quiz mainly suitable for testing knowledge, not gaining new knowledge. Especially the feedback options for Quiz questions are very limited. This is logical, as extensive feedback options make no sense in a quiz context where a student can try a question only once. Quiz questions also do not work outside of a Quiz.

---------------------------------

Module: Proteus
Download: http://wmmrc.wur.nl/drupal-modules/download

The Proteus module shows questions to the user in a certain order, based on the student's current knowledge. The mechanism behind the order of the question is described in: http://wmmrc.wur.nl/sites/wmmrc.wur.nl/files/Proteus-A_Lecturer-Friendly...
The Proteus module depends on the ClosedQuestion module.

From a student's point of view:
* A student starts at a level of 0 for each objective.
* The student can get questions that have an entry level that is lower than or equal his current level.
* If a student answers a question correct in 1 try, his new level will be the exit level for each objective linked to that question.
* If a student needs more tries, his new level will be lower than the exit level.
* Once a student reaches the target Level for all objectives of the Proteus Quiz, he has finished the quiz.

---------------------------------

Module: LinearCase
Download: http://wmmrc.wur.nl/drupal-modules/download

The Drupal module LinearCase allows ClosedQuestions and other documents to be ordered in a "case study".
A linearcase is a book that limits a students navigation. A student can progress through the book freely, untill he reaches a page with a question. The student then has to answer the question correctly before he can go to the pages beyond that question.

Comments

HylkeVDS’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new7.5 KB
new15.99 KB
new44.46 KB
avpaderno’s picture

Status: Needs review » Needs work
Issue tags: +Module review

Hello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review your code, pointing out what needs to be changed.

We review just a module per applicant; please let us know which one you want reviewed.

qasimzee’s picture

I reviewed Closed Question and following are the things needed to be corrected

1. Use an indent of 2 spaces, with no tabs through out the module

2. Line 279: else statements should begin on a new line
} else {

Please read coding standards for details.

HylkeVDS’s picture

StatusFileSize
new45.21 KB

The ClosedQuestion module is the most important one, so that is the best one to review indeed.

I've updated it to the coding standards.

HylkeVDS’s picture

Status: Needs work » Needs review
zzolo’s picture

Status: Needs review » Needs work

@HylkeVDS, thanks for the application and patience. The following points are just a start and do not encompass all of the changes that may be necessary for your approval. Also, a specific point may just be an example and may apply in other places.

  1. Follow Drupal Coding Standards. Note that Drupal coding standards are more than just PHP code. Also, look at using Coder to help automate SOME of this.
  2. You CHANGELOG has version numbers. These will have to be consolidated once put into Drupal CVS.
  3. Ensure $Id$ is all files (aka TODO.txt)
  4. version = 0.31
    

    Do not specify version.

  5. You do not use primary keys in your database tables. This greatly helps indexing and querying.
  6. You need to have docblocks for all functions, classes, and files.
  7. /**
     * Install and update functions
     */
    function closedquestion_schema() {
    

    Please use the format "Implements hook_schema()." as stated in coding standards for ALL hook implementations.

  8. You do not need an update function as this module has not been released yet. Overall, what we review needs to be ready for CVS and d.o.
  9. include_once 'question/CQ_Question.class.php';
    include_once 'question/CQ_QuestionAbstract.class.php';
    include_once 'question/CQ_FactoryQuestion.inc.php';
    include_once 'question/CQ_UserAnswer.class.php';
    

    Do not put includes in the global scope. They should be included when necessary (ie menu items or hooks) or if absolutely necessary, in hook_init(). Also, utilize module_load_include().

  10. define('CQ_ACCESS', 'access closedquestions');
    define('CQ_CREATE', 'create closedquestion');
    define('CQ_EDITOWN', 'edit own closedquestion');
    define('CQ_EDITALL', 'edit all closedquestions');
    define('CQ_ADMIN', 'administer closedquestion');
    

    Constants need documentation blocks as well.

  11.   $items['node/%node/cq_text'] = array(
              'title' => 'Text',
              'page callback' => 'closedquestion_text',
              'page arguments' => array(1),
              'access callback' => '_closedquestion_text_access',
              'access arguments' => array(1),
              'type' => MENU_LOCAL_TASK,
              'weight' => 2,
      );
    

    Please space correctly as outlined in the coding standards.

  12. 
    /**
     * Menu callback; show view with all the users that answered a single question.
     */
    function closedquestion_users($node) {
      // add view html to page contents
      $retval = '<h2>' . t('Users that answered question %nodename', array('%nodename' => $node->title)) . '</h2>';
      $retval .= views_embed_view('ClosedQuestionUsers', 'default', $node->nid);
      return $retval;
    }
    

    All output needs to be in theme functions.

  13. /*************
    * Node hooks *
    *************/
    

    Unnecessary

  14. /**
     * Wrapper to quickly create a fieldset.
     * @param string $title Title of the fieldset.
     * @param string $body Body of the fieldset.
     * @param boolean $collapsible can this fieldset be collapsed?
     * @param boolean $collapsed is this fieldset collapsed by default?
     * @return string a themed fieldset.
     */
    

    Good start put please follow standards.

Overall, good start. Please follow coding standards.

--
Note: Please be patient with the CVS application process. It is all done by volunteers. Our goal is not to be arbitrarily slow or meticulous. Our goal is to get you CVS access and ensure that you are and will become a more responsible Drupal contributor. For a quick reference on what I look for in a code review, please see this article.

avpaderno’s picture

To understand which changes are strictly necessary to get a CVS account, see http://drupal.org/node/539608.

HylkeVDS’s picture

Status: Needs work » Needs review
StatusFileSize
new58.37 KB

Thanks for the review, those pointers improved the code quite a bit :)

Do you have any pointers on how to handle old version numbers in the changelog?

avpaderno’s picture

Status: Needs review » Needs work
  • The points reported in this review are not in order or importance / relevance.
  • Most of the times I report the code that present an issue. In such cases, the same error can be present in other parts of the code; the fact I don't report the same issue more than once doesn't mean the same issue is not present in different places.
  • Not all the reported points are application blockers; some of the points I report are simple suggestions to who applies for a CVS account. For a list of what is considered a blocker for the application approval, see CVS applications review, what to expect. Keep in mind the list is still under construction, and can be changed to adapt it to what has been found out during code review, or to make the list clearer to who applies for a CVS account.
  1. Menu descriptions and titles, schema descriptions are not passed to t().
  2. See http://drupal.org/coding-standards to understand how a module should be written. In particular, see how the code should be formatted; how Drupal variables, global variables, constants, and functions defined from the module should be named.
  3. The module requires PHP5, but it doesn't declare its dependency from it.
  4. Some of the points reported by zzolo are still valid, like the one about including PHP files only when necessary.
HylkeVDS’s picture

Status: Needs work » Needs review
StatusFileSize
new57.22 KB

@1: Menu Titles and Descriptions should no longer be wrapped in t(). (http://drupal.org/node/140311) The coder module also complains if you do.
And I don't see any schema descriptions that are not passed to t()? Or did you mean I was missing descriptions in the menu items? I added those now.

Renamed all classes to remove underscores, added Interface suffix to interfaces, removed camelCase from all non-class methods and variables.

Removed all class file includes and moved to using the autoload module. Added the minimum php requirement for autoload.

Fixed several doc sections and other small things.

I have a question about naming theme functions. I have a lot of theme functions that theme a specific object type, like "theme_CqOption" that themes a CqOption. Naming convention states that that should be named "theme_cq_option" but it seems to me to make more sense to keep the exact class name in the method name. Is it better to stick to the convention, or to use the more descriptive name?

HylkeVDS’s picture

StatusFileSize
new56.7 KB

I just found out that mixing autoload-dependant classes and theme functions in the same file does not work. Update.php updates the theme registry without loading autoload, and thus gives a fatal error if it can't find required classes or interfaces that are needed for the class that is in the same file as the theme function.
Theme functions are now all in a separate file.

zzolo’s picture

Status: Needs review » Needs work

@hylkevds, thanks for the application and patience. The following points are just a start and do not necessarily encompass all of the changes that may be necessary for your approval. Also, a specific point may just be an example and may apply in other places.

  1. As mentioned by @kiamlaluno, theme function names are camel case, please follow Drupal Coding Standards. Also, variable names, class names, etc. I know this is a big change, but this is a very widely used/accepted standard for Drupal.
  2.     t('Σ Transfer'),
    

    Please use HTML special entities or some other better method of encoding non-standard characters.

Very close!

--
Note: Please be patient with the CVS application process. It is all done by volunteers. Our goal is not to be arbitrarily slow or meticulous. Our goal is to get you CVS access and ensure that you are and will become a more responsible Drupal contributor. For a quick reference on what I look for in a code review, please see this article.

HylkeVDS’s picture

Status: Needs work » Needs review
StatusFileSize
new64.78 KB

I noticed the camelCase variable names myself just yesterday as well. Apparently coder misses the camelCase in non-class functions if there's a class in the same file above the function. I didn't re-check the coder output after I moved the theme functions, as all I did was move some functions, so I didn't expect any new coder output. :)

As for the theme function names, I asked about those in #11. I've changed 'em to the lowercase now, long live regexxer :).

I've replaced the Σ's with &Sigma;

Development has continued. This new version has some new functionality that uses the EvalMath class available under a bsd-licence. It's in lib/evalmath.class.php. I could not find any policy on including 3rd party code that has a compatible licence so that might need a closer check. I did update the class to follow the coding standards.

This version also has an updated db schema, so if you already installed the previous one, you'll have to uninstall it first.

HylkeVDS’s picture

StatusFileSize
new67.74 KB

Here's an updated version.

HylkeVDS’s picture

StatusFileSize
new79.96 KB

[oops, double post]

HylkeVDS’s picture

StatusFileSize
new79.96 KB

Another new version. I found a GPL2 version of the EvalMath file, and ported all my changes to that version. That solves any potential licence problem. I've not found any active upstream for EvalMath, seems like it's not been under development for the last 5 years.

I've also made a start with advanced-help documentation.

HylkeVDS’s picture

StatusFileSize
new70.88 KB

Fixed some missing $Id$'s

zzolo’s picture

Status: Needs review » Fixed

Hi @HylkeVDS. Thanks for all the work on this. I am going to push this through. Please note the suggestions below, specifically the first one, which you should really do before releasing, as naming convention and namespaces are very important in the way that Drupal does things.

  1. Theme function names are not good. They should be converted: 'theme_cq_option' => 'theme_closedquestion_option' . This is really important, because it could easily cause conflicts if someone makes a "cq" module.
  2. closedquestion_autoload_info() could easily happen with some short logic and better consistency with file names.
  3. Please update the CHANGELOG.txt to reflect moving to development to drupal.org infrastructure

Please read the following resources to make sure you know how to use CVS and the specifics to the Drupal CVS infrastructure, as well as how to be a good module maintainer on Drupal.org. The Drupal community is very large and dynamic; we welcome you as a module maintainer and hope that you embrace and challenge the Drupal community and continue to contribute.

Thanks again for all your hard work and patience. Happy hunting.

Status: Fixed » Closed (fixed)
Issue tags: -Module review

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

Component: Miscellaneous » new project application
Issue summary: View changes
Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.