Whenever possible I've found letting students learn trying is the best option.
What I've tried in the past is to assign each student a logical subsection of code (arm control, drive control, driver feedback, etc.), remove that piece from the existing code, and let them try to recreate a functional version of it.
Here are a few rules I've used for this method:
- Do not show them your final code.
- Answer any questions they have, but don't show them how to write it.
- Start simple. Don't use sensors/feedback if possible, reduce the requirements to the minimal needed to get the robot to do anything.
- During this process suggest they follow any code conventions/source control processes you use.
- Once their code does anything increase they reqirements adding sensors/feedback, more advanced input/motor mappings, etc.
An alternative to this is to give them the final code, and ask them to add some functionallity. However I find that the additional functionallity usually wasn't implemented for a good reason, often difficulty.
You can also do this is pairs/groups, but that usually leads to only one person learning/doing anything unless they have coded together before.