Allowing students to edit multiple source files

Allowing students to edit multiple source files

by Carlos Rincon -
Number of replies: 3

For my C++ Object Oriented Programming course, I have been using the CodeRunner plug-in for all my exams.

For questions with multiple .h and .cpp files, I have allowed students to download these files from the question description, modify them in any editor, and upload the modified files as attachments to the question solution.

Starting this semester, I have decided to use the Safe Exam Browser to prevent students from using unauthorized resources. This change also prevents students from downloading and modifying files to add them as attachments to the solution. 

It would be great if the CodeRunner plug-in allowed students to edit multiple files in the Ace editor (presenting multiple tabs). Still, I know that this proposed suggestion (if approved) will take a while to be implemented.

Can someone share how you present a question where students must edit multiple source files using the Safe Exam Browser?

Thanks in advance for your help.

In reply to Carlos Rincon

Re: Allowing students to edit multiple source files

by Richard Lobb -

The Ace editor does not support tabs out of the box. There are a couple of examples on the web where people have added tabs to Ace, but I'm not sure how robust they are. You're on your own if you want to head down that path.

The best suggestion I can come up with is to use the HTML UI to provide an interface with three (or n) separate Ace editor panels. For example:

Screen shot of multiple ace-editor question

I attach the export of the question shown above. The globalextra field of the question defines the UI the student sees and the template (written in Python) processes the student answer to split out the three Ace editor panels, write them to files and compile and run.

Some caveats:

  • It has had negligible testing. Use at your own risk.
  • It might have issues with synchronising the loading of the Ace editor in some environments, necessitating a reload (or redesign!).
  • The question as it stands is rather pointless, because students could put all the code in prog.c and ignore the other two fields. So you'd need to add more tests to test different aspects of the submission.
  • I would strongly advise against using a question of this sort in an exam until it has had lots of testing in a normal lab environment.
In reply to Richard Lobb

Re: Allowing students to edit multiple source files

by Carlos Rincon -
Dear Richard Lobb:

Thanks for the quick reply. I have modified the proposed question, and it is working as expected. Can you elaborate on this caveat: There might be issues with synchronising the loading of the Ace editor in some environments, necessitating a reload (or redesign!).

Next week, I will do a quiz for 35+ students using a question similar to the one you provided to test the performance of my Moodle server using this type of question.

Can you also tell me if this type of question uses more resources (CPU, memory, and hard disk) than a question with attachments and support files?

I am attaching the export of the modified question (for comments and observations).

Thanks again for all the work you do.

In reply to Carlos Rincon

Re: Allowing students to edit multiple source files

by Richard Lobb -
Hi Carlos

Good to know it's working.

My caveat about loading issues was mostly just me covering my butt in case something weird happened.

There are occasionally problems loading the Ace editor in some environments, such as with very slow or misconfigured servers, clogged networks or disabled JavaScript caching. The loading of Ace in this case is more complicated than usual because there are three separate instances of the UserInterfaceWrapper class being created, each of which is requesting the Ace editor. I've never run three UserInterfaceWrappers in a UI before, although we've run with two instances on many occasions in our own labs. So I was being super-cautious, warning you that you're proceeding at your own risk here. I think problems are unlikely but I'm never prepared to say the're impossible.

I'd be very surprised if resource usage is a problem compared to attachments and support files, unless you have very large files. Attachments and support files are cached on the Jobe server, so are (usually) uploaded only once. But in this question model, they are sent encoded in the Json student-answer response every time. However, the extra size of the response is almost irrelevant compared to the compile time cost. And you might even win fractionally if every student submits a different answer because with attachments there are two round trips to the Jobe server if an attachment isn't in Jobe's cache (one on the assumption the file is there already and the second, with the file, when a 404 response is received). But g++ compile times are huge compared to all such overheads unless you have huge files. Certainly the cost of running via Python rather than directly through PHP is completely swamped.

I have no particular observations about your question except to ask if you have considered the use of the Ace-in-line filter extension? It works hand-in-hand with CodeRunner to allow you to display editable or (in this case) read-only code inside the Ace editor within your question text. Looks much nicer.

One other thought occurs: if you were to write questions with lots of test cases, this model would be inefficient because each test is a separate Jobe task, with its own compile-and-build. You can avoid the multiple compiles by use of a combinator template, which receives all the test cases in a single run. But it adds a level of complexity.

Richard