A resource to help students master the beauty of programming
This project’s resources – integrated programming tutorials and exercises to enhance students’ understanding of physics while developing their overall skillset – were originally developed by a team of physicists (JJ Eldridge, Kathleen Foote, Nicholas Rattenbury, Maarten Hoogerland, and Peter Wills) from the Faculty of Science at the University of Auckland. The resources were trialed with a group of first-year physics students through 2017, and will be made publicly available in early 2018.
These resources might be useful to teachers of basic programming in STEM disciplines.
The project was supported by the SEED Fund grants for 2017.
For similar projects, see: Writing code the visual and kinaesthetic way.
Instead of students learning to code “by osmosis”, JJ Eldridge and his team wanted to embed programming through the Physics curriculum by developing a set of instructional materials and tutorials with simulation activities for their students. As they explained in their SEED grant application, “computation and simulation play increasingly vital roles in science, bridging the divide between empirical investigation and abstract theory. Separately, modern computational platforms allow the creation of interactive documents, which are playing an increasingly important role in scientific publication and communication.”
They decided to create for their Stage 1 students supportive instructional materials, including short YouTube videos demonstrating basic skills (loading data, presenting results, using loops and animation, basic debugging, etc.) in contexts drawn from the Auckland curriculum. The second phase of the project would develop more open-ended Stage 2 assignments, to be trialed in Semester 2 of 2017 in other courses with the same initial cohort of students. They chose to use VPython, “an object-oriented language that it easy to learn and widely used in both teaching and research settings.”
JJ Eldridge explained: “At Stage 1, assignments will have a “minimal working program” format with a skeletal structure with students adding code targeted at key physics and programming concepts. The goal for Stage 1 is to create programs that embody physical models and aid physics understanding, for example, of the magnetic field generated by a moving charge. In Stage 2, more open-ended activities would move students toward writing sophisticated code, starting from scratch. Students would document their code in Jupyter Python Notebooks to a level that other users can interpret and adapt their work, so that their code becomes a tool that facilitates communication and collaboration between students and researchers.”
Below you can read the team leader JJ Eldridge’s reflection on their teaching innovation project.
What were the objectives of your project?
The objective of our project was to teach students not just to code but to write well-commented and structured code that allowed others to read and understand it easily. Being able to write code that can be used by others is an important skill that will increase the employability of students.
What went well? What was unexpected?
The coding was first implemented into our new PHYSICS 121: Advancing Physics 2 course during 1st semester of 2017 with students required to code in groups. We used resources developed by a Graduate Teaching Assistant, Matheu Bloom, for the assignment the students would undertake.
While the groups did the coding in the end most of the coding was done by one student rather than being the collaborative endeavour we were aiming for. We also did not explain to students clearly enough why learning to code was important. We also found that the students had trouble using the Jupyter Notebooks we had been expecting them to use. This led to Dr Katie Foote to switch to use Glowscript.org for the 1st year students to get used to coding without having to worry about the extra complexities of the Jupyter Notebooks. While the coding environment is not as pleasant it is simpler and less other things to go wrong beyond writing bad code.
We then realised we had to write new resources during the second semester to change our assignments over to GlowScript. We also decided that in the second year, we would build on the new knowledge the 1st years had gained. To do this, clearly, we needed new resources. The second year resources would be for Jupyter Notebooks as the students would be more familiar with coding so should be able to deal with the richer coding environment.
We now have a larger set of resources and have begun to create a “Physics in Python” resource website in CourseBuilder. This is still under construction but all the videos and example codes have already been uploaded to this University’s internally accessible CourseBuilder website.
We aim to make this public before Semester One next year.
How did the project contribute to your students’ learning? (How do you know?)
We know the students learned more about coding as they all had to turn in an assignment on this. However, it won’t be until next year, when we ask the students to write code individually for assignments in 2nd year courses, that we’ll know if the foundations we built were strong enough.
Student coding skills will also be tested again in 3rd and even 4th year course with lecturers becoming keener to set coding assignments in all courses rather than just leaving them in the labs.
How did the project contribute to your learning?
The project has developed our understanding of how best to teach coding. We realised that:
- coding itself can be difficult enough without having to worry about the extra complexity of
- coding can become a useful teaching tool and
- how best to organize coding assignments to maximize learning.
- When teaching students how to code we also have to remember that systems and infrastructure change so we need to be able to adapt. (The Jupyter hubs have previously been hosted on University servers, but we have found out that the e-research centre are moving over to Microsoft Azure Notebooks. We forgot to consider that the infrastructure we were planning to use might change.)
Do you plan to continue this initiative beyond the grant period?
Yes! As mentioned above coding and Python are being integrated at all levels of Physics courses, and the construction of the CourseBuilder website is ongoing. We have to continue the project as it is key to producing high-skilled and employable physics graduates.
Click here to download a .pdf file with GlowScript and Jupyter examples used by JJ Eldridge’s team in their classes.