Multilanguage support

Multilanguage support

von Andreas Dedner -
Anzahl Antworten: 6

Hi.

I'm new to CodeRunner and found it really easy to get started. Thanks for the great work. This should help a lot with giving student more confidence in their programming skills (and reducing my work load at the same time I'm hopping...)

I have the following issue and I'm hoping to get some idea on how to tackle it:

I've allowed students to submit their answers in Matlab/Octave or Python3. I've started off by writing codeRunner questions for both languages and for the simple cases I've been looking at so far that is not an issue. But now I'm wondering how to best put questions together into a moodle quiz and was hoping someone might have some good ideas.

1. I could try to extend the 'multilanguage' question type to include octave. Probably easy to do but I don't know where to find the information on how to run octave student code. The advantage would of course be that I would have no duplication of the question so that maintenance would be much easier.

2. Make two quizzes, one for Matlab users and one for Python users. That is perhaps the easiest to get started with but has the additional maintenance issue. Also I can't really stop students submitting answers to both quizzes (some might just do that for fun) and then I would have to check the result database to remove double submissions because I can't give them double marks.

3. Somehow get moodle to branch so that depending on some tick box only one or the other language question appears. But I have no idea how to do that....

Is there some other approach I'm missing? I wouldn't mind doing (1) but would appreciate some pointer on how to add octave support to the multilanguage question type?

Als Antwort auf Andreas Dedner

Re: Multilanguage support

von Andreas Dedner -

I made some progress and have a question prototype with grader that does approximately what I want. One can have answers and tests containing both Python3 and Octave code and both versions are tested. The student can enter either and it gets tested appropriately. Actually this will hopefully work for me. The only optical think I do not like is that the 'example' test code shown in the question box contains both the Python3 and Octave code. But that is not really an issue.

I would appreciate any suggestion for improvements especially with the grader since that is probably quite difficult to get right (and resilient against student's mistakes) as mentioned in the documentation.

I attached the prototype (which also contains an example) and a possible question.

Thanks again for the great work - I hope I can teach student how to 'unit test' code with this!

Als Antwort auf Andreas Dedner

Re: Multilanguage support

von Richard Lobb -

Nice! I was going to reply to your earlier posting pointing out that a problem with multilanguage questions was that you were stuck with "write a program" questions, which is rather limiting. However, you've shown that's not the case -very elegant! I like that your sample answer includes solutions in both languages, and both answers get tested when the question is saved.

I don't think it's a problem that students see the test code in both languages; it might even be considered a useful extra learning outcome. You might be able to avoid it by embedding in the question JavaScript code to switch the display between the two forms of the test according to the setting of the language dropdown but it would be a lot of work for very little gain - possibly even a loss.

It's probably rather annoying having to write all test cases in both languages, but it's hard to avoid that. You could possibly have a test-specification language in which you define tests in a form that could be interpreted in either Python or Octave but that would probably confuse the students and would be a lot of work. 

I didn't see any issues with your grader. It certainly handled runtime errors and timeouts in my python solution. Let's see what the students manage to do to break it!

Thanks for a useful and instructive example.

Als Antwort auf Richard Lobb

Re: Multilanguage support

von Andreas Dedner -

Thanks for the quick reply. It's been fun looking into this.

Perhaps you're right with the two language examples. I was just worried the block in the question text could become quite large if I were to include multiple test examples and each with 2 code examples. But I'm not going to start with JavaScript now that sounds painful. I'll leave things as is for now and let's see what the students do with it.

Als Antwort auf Richard Lobb

Re: Multilanguage support

von Al Oz -

I have a question about the javascript code you mention here. I would like to preload (and refresh when needed) the answer text area based on the drop down selection. I looked around the js files. It looks a lot of work as you suggested. Would you consider adding extra answer fields for selected languages in the question form instead?

Als Antwort auf Al Oz

Re: Multilanguage support

von Richard Lobb -

The primary use of CodeRunner is in teaching programming and I think (without good data) that very people use multilanguage questions . I myself use them only for program contest type questions, where we don't provide sample answers anyway. So I'm reluctant to put effort into something that I feel is very much a niche market, especially when the authoring interface is already very complex. However, I'll keep an open mind and see if anyone else requests such a capability.

Als Antwort auf Richard Lobb

Re: Multilanguage support

von Al Oz -

Thank you for the information. I ended up adding multiple answers in the only field with a separator and regexing it in the browser. resetbutton and ui_ace js files are affected. It mostly works.