dodona-edu / dodona

🧑‍💻 Learn to code for secondary and higher education
https://dodona.be
MIT License
68 stars 22 forks source link

Add JavaScript tutor #46

Open dmouriss opened 5 years ago

dmouriss commented 5 years ago

For the moment the tutor loads the code from the file testcode.js located in the root directory. This can be seen by surfing to /tutor/....

The view executes jslogger.js (for the moment located in the home directory of the webshare) with node js. This generates a json file that contains the necessary information for the tutor. This json string is loaded in the javascript of the view and the javascript to build the tutor ui is executed.

These are som things that need to be done:

Original issue by @dmouriss on Thu Apr 21 2016 at 17:30.

bmesuere commented 5 years ago

So if I get things right, the first thing to do is actually test the code server side with node js?

Original comment by @bmesuere on Thu Apr 21 2016 at 20:34.

dmouriss commented 5 years ago

The jslogger script should be tested with node js. It generates a traceback in json format that is used to create the python tutor ui. It is already on the server in the dodona home directory. The following command is used to call the jslogger script.

node --expose-debug-as=Debug ~/jslogger.js --jsondump=true <file>

Original comment by @dmouriss on Thu Apr 21 2016 at 20:47.

bmesuere commented 5 years ago

But if the JS engine on the server and the client aren't the same, wouldn't this be confusing for students? For example for browser-specific errors?

Original comment by @bmesuere on Thu Apr 21 2016 at 20:55.

dmouriss commented 5 years ago

The python tutor has to 'compile' the code into a json traceback. And I'm not sure this is easily done client side since the scripts needs a Debug object that you can get by passing the expose-debug flag in node js. I don't have any idea if this is possible in regular javascript.

Were we not planning to move the judge serverside and use node js? That would solve it, I guess. Otherwise we could look into ways to build the traceback ourselves.

P.S: We also had that problem on pythia, the tutor used a different python version, so the results in the tutor did not always match the results in the tests. But this was something that was quite rare. Do you think it will be more common with javascript?

Original comment by @dmouriss on Thu Apr 21 2016 at 22:01.

bmesuere commented 5 years ago

Yes, error messages are browserspecific and ES6 support is mixed. I already had someone asking why something worked locally (using node and webstorm) but not in Firefox.

Original comment by @bmesuere on Thu Apr 21 2016 at 22:13.

pdawyndt commented 5 years ago

@bmesuere @dmouriss if the Online JavaScript Tutor (OJT) works the same way as the Online Python Tutor (OPT), there is no other option than providing server-side support; this is how the OPT/OJT work

Original comment by @pdawyndt on Wed Apr 27 2016 at 18:43.