A user recently got in touch and mentioned that they were creating essentially the same problem in both Java and Python and wondered if there was an easier way. That got us thinking. It seems silly to have to create separate problems when all that’s different is the language.
Looking into our code there’s really not any difference in a Java or Python problem if you’re using Simple Testing or Output Matching. The only real difference is what you set the language drop down to when you create the problem. So we’ve added a Multiple option to the language drop down.
Separate Starter Code
First thing to check is that, when multiple languages is selected, is that there are tabs over the starter code field. This way you can give your students starter code depending on what language they’re using.
Now you can give your students something to start with no matter which language they’re using.
If you’re attaching data or other files to submissions there’s an extra option there as well.
Between the visibility toggle and the trash can icon there’s now a drop down so that you can pick which languages go with which attached files. If you leave it at the default of All they’ll be there for any language. If you select either Java or Python your students will only see them when they’ve selected that language.
There’s a little addition to the Test button on multiple language problems.
The button changes from just Test to Test and the current language. Your students can change between languages by clicking on the down arrow on the right.
When you click test ClassCube will run your code the same way it always has.
One snag. You won’t have the multiple languages option if you’re using a problem set to Unit Testing for grading. Since you would be writing a separate unit test file, or set of files, for each language anyway it made more sense to keep this one separate.
Currently a problem is either a set language or multiple languages. Our first tweak to allowing multiple languages is to allow you to select the language when you create an assignment.
Let’s say you’re teaching a Java course and a Python course and want to use the same problem in both. By allowing you to select the language at the assignment level you’ll be able to keep your Java students submitting Java and your Python students submitting Python.
The plan is to roll assignment language selection within the next few weeks.
If you have another language you’d like to see added, or just want to +1 C++ or JS, please let us know.