Kelly Bodwin is an Assistant Professor of Statistics at Cal Poly (San Luis Obispo) and teaches multiple courses in statistical programming. Based on her experiences, she compiled this great shortlist of five great tips to teach programming.
Kelly truly mentions some best practices, so have a look at the original article, which she summarized as follows:
1. Define your terms
Establish basic coding vocabulary early on.
- What is the console, a script, the environment?
- What is a function a variable, a dataframe?
- What are strings, characters, and integers?
2. Be deliberate about teaching versus bypassing peripheral skills
Use tools like RStudio Cloud, R Markdown, and the usethis
package to shelter students from setup.
Personally, this is what kept me from learning Python for a long time — the issues with starting up.
Kelly provides this personal checklist of peripherals skills including which ones she includes in her introductory courses:
Course Type | Install/Update R and RStudio | R Markdown fluency | Package management | Data management | File and folder organization | GitHub |
---|---|---|---|---|---|---|
Intro Stat for Non-Majors | ⚠️ | ⚠️ | ❌ | ❌ | ❌ | ❌ |
Intro Stat for Majors | ✅ | ✅ | ⚠️ | ⚠️ | ⚠️ | ⚠️ |
Advanced Statistics | ✅ | ✅ | ✅ | ✅ | ⚠️ | ⚠️ |
Intro to Statistical Computation | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
✅ = required course skill
⚠️ = optional, proceed with caution
❌ = avoid entirely
via https://teachdatascience.com/teaching_programming_tips/
3. Read code like English
The best way to debug is to read your process out loud as a sentence.
Basically Kelly argues that you should learn students to be able to translate their requirements into (R) code.
When you continuously read out your code as step-by-step computer instructions, students will learn to translate their own desires to computer instructions.
4. Require good coding practices from Day One
Kelly refers to this great talk by Jenny Bryan on “good” code and how to recognize it.
Kelly’s personal best practice included:
- Clear code formatting
- Object names follow consistent conventions
- Lack of unnecessary code repetition
- Reproducibility
- Unit tests before large calculations
- Commenting and/or documentation
For more R style guides, see my R resources overview.
5. Leave room for creativity
Open-ended questions (like “here’s a dataset, do a cool analysis“) let students explore and shine.
Large parts of the above were copied from this original article by Kelly Boldwin. I highly recommend you have a look at the original, and at the website hosting it: teachdatascience.com
Cover picture by freecodecamp.org.