General developer forum

Magnitude of time for plugin development

Picture of Yorick Spenrath
Magnitude of time for plugin development

Hi all,

I am new to moodle, as well as relatively new to php. I am employed for a university where my task is to develop a new type of digital testing. We have concluded that our best option is to write a moodle plugin. I have been diving into the moodle code for a bit the last time.

Today I concluded I really have no clue on what kind of magnitude of time my work will take. The digital testing I need to develop is like a multiple choice question, but with dynamic answers. So say, if a student answers question 1 erroneously, then the values of the multiple choice answers of question 2 should be adapted on this.

For example: in question 1 the student is asked to calculate the position of a point mass. Let's assume the correct answer would be (0,0,z), and the incorrect answer the student picks is (0,0,2z). In question 2 the student is asked to calculate the potential energy of the the same point mass (where there is 0 potential energy on the xy-plane). Based on the correct answer for the first question, this would be m * g * z (where m is the mass, g is the gravitational acceleration). However, since the student picked (0,0,2z) as their answer, the new correct answer would be 2 * m * g * z (and as it is a multiple choice question, there would also be erreonous answers available, also based on the answer given in Q2).

I was wondering if anyone could help me to at least grasp the amount of work I am looking to, or at least a very crude estimation/reasoning. I have no previous experience in moodle, and barely in web development. I have some PHP experience, but I had no trouble learning new programming languages in the past. My main programming experience comes from Java.

Thanks in advance

Average of ratings: -
Richard Jones
Re: Magnitude of time for plugin development
Particularly helpful MoodlersPlugin developersTesters

Based on my own experience with a comprehensive Moodle background and Java programming teaching/development skills,  plus a few years playing around with Moodle PHP code, I can tell you that I put in about 40 hours study over one year on two taught courses, several months (part-time) into producing a couple of plugins and am confident that I could produce an application such as the one you describe.  

I recently submitted an activity module of some complexity which is awaiting approval.

I would say that the reasons it took me so long are:

  • Lack of documentation in key areas of Moodle dev means looking around the codebase for examples/inspiration.
  • Inconsistencies in design and implementation approaches across Moodle core modules and plugins can be confusing.
  • Pressure of other work.
  • Little information on the web once you get to the detail - if the dev forum doesn't help there's nowhere else to go effectively.

You can speed up development considerably by:

  • Finding Moodle activity templates on Github.
  • Checking the plugins database to see if there is already something similar to what you want to do.
  • Finding yourself a suitable mentor (no, I'm not touting for business - or volunteering).

Hope this helps.

Average of ratings: -
Picture of Virgil Ashruf
Re: Magnitude of time for plugin development
Finding yourself a suitable mentor (no, I'm not touting for business - or volunteering).

There is a Telegram developer room that seems suitably active where you can connect with other Moodle developers. You can also find helpful information on the Moodle Tracker.

Are you sure you want to develop a complete plug-in? Might it be possible that a Question Behaviour + a Question Type might be more suitable for your job at hand? The question behaviour will influence the question type and you can still use both of them within the normal confines of the quiz plug-in.

To answer these you might find these docs helpful:


Edit:, i might think that when you override the first init method you can pass it on to your question type. The question type will then pick the right answer options based on the given answer of the question before.

Happy puzzling! Please share your work when you're progressing, I'm quite interested.

Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Magnitude of time for plugin development
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

To solve your immediate problem, don't try to develop anything. Install the STACK question type. If you follow the links from to the Demo site, and then the Demo quiz within it, then you will see that some of the questions have multiple marks and implement follow-through marking.

However, as Chris Sangwin, creator of STACK, and literally author of the book on Computer Aided Assessment of Mathematics says: in online testing, why would you want to do that. Having to cope with students getting part 1 wrong is really an artefact of paper-based testing, where you grade all the questions at the end. With a computer, if the student gets part 1 wrong, then you can tell them that immediately, and let them have another go until they get it right. Then you can move onto question 2 on a sound footing.

None of that answers your question about learning Moodle development. Certainly it is the case that the more experience and knowledge you have, the quicker it is to implement any particular plugin, so doing an estimate for someone else is almost impossible.

Also, the way to effectively learn Moodle development is to start with some simple projects first, and without knowing it, you have picked an almost impossibly difficult place to start. It was an assumption baked into the quiz module code form the start that each question in a quiz would be completely independent. There is no way to communicate information from one question to the next (short of really horrible hacks). That is why all the STACK example only do follow-on marking within one larger multi-part question.

I hope that helps.

Average of ratings: Useful (2)
Picture of Marcus Green
Re: Magnitude of time for plugin development
Core developersParticularly helpful MoodlersPlugin developersTesters

I have been developing Moodle quiz question types for over 6 years and I can heartily recommend all the advice from the other posters in this forum, particularly Tims suggestion of don't develop anything and checkout STACK. 

If you go with Stack you instantly get free access to what is clearly the worlds finest example of Maths quiz question technology . It can seem daunting at first but I managed to get it up and running and even created a few example questions despite my only Maths qualification was a CSE grade 1 in 1976.

My other advice is that if you do end up developing a plugin this book is rather good and from someone who knows their subject (don't worry about the Moodle version in the title, the principles are the same)

Moodle 3.1 LTS modules development, Tomasz Muras.

Yorick, please post a follow up on your thoughts as you have asked a well made interesting question.

Average of ratings: Useful (2)
Picture of Yorick Spenrath
Re: Magnitude of time for plugin development

Hi all, and so sorry for the late reply, 

I have been given a few very good directions for investigation, for which I would like to thank all contributions.

Concerning the question relating to "why would you", there are a number of reasons. The first is simple, because I am a student assistants to a professor who wants to quiz her students this way. Of course that is no real reason, so the second reason, how I looked at it in my own way: say you want to simulate a graded solution. As said, this type of behaviour from a quiz is a natural consequence of paper testing, but what if you want someone to have one go with the test, as well as have it timed. In that case you don't want students to change their previous answers, nor would you want to give feedback right away. A third way, in non-graded quizzes, is purely didactical : you want students to work their way through a complete exercise, but for the sake of education you want to split up a much bigger exercise (the one example I gave for instance, or a much more complex dubble pendula) into smaller exercises. You then make the students either find out they messed up as they are working on the exercise, or once they finish all smaller parts. The final goal would be to have them be able to work out the more complex example in one go (like on a final exam).

I am currently away for a few more weeks, but once I get back I will update my progress in this discussion every once in a while when I have something useful.

With kind regards, 


Average of ratings: -