Common Pitfalls When Teaching Students to Code

This list was compiled by Christa Kelleher, JP Gannon, and Nate Jones, and represents a list of common issues we think all instructors need to be aware of when first teaching students how to code.

How to unzip a folder: Why? This is an important skill to learn in whichever operating system (OS) the instructor and student are using.  More specifically, we have found this to be a common issue for students using the Microsoft Windows OS. Recent Microsoft updates allow students to view files before unzipping, leading to confusion when they can’t access the data.

Differences between file types: Why? Not all students are aware of the differences between txt, csv, and xlsx files.  As this will impact how they import data, it’s worth discussing the differences (and what type you prefer they use in class, if they’re going to be using their own data at some point).

Types of data structures: Why? All programming languages use different data structures (e.g., vector, matrix, data frame, tibble in R).  Be sure to introduce how to identify the type of data structure, why different data structures exist, and how students use this throughout the course.

Using an IDE: Why? Integrated development environments (IDEs) enable writing and executing testing code in a software (e.g., RStudio for R).  Many if not all of your students will never have opened the software you are using.  Spend time orienting them to the different components of the IDE.

How to load libraries/packages: Why? Many, though not all, programming languages use libraries or packages to facilitate functionality.  Students need to be introduced to what a library or package is, and how they can load and access it within their IDE.

R as a calculator: Why? It introduces students to the idea of a command line and how to interact with the IDE.

File settings: Why? Depending on the programming language and IDE students are using, there are likely settings within the software that will make it easier for them to access files.  This may also require you to explain the idea of a path and how to navigate file directories.  Likewise, there may be other initial settings to implement that will make it easier when it comes to scripting and saving files.

Software versioning: Why? Your life as an instructor will be much easier if you ensure everyone is using the same version of the software and libraries.  We recommend introducing versioning to your class, to not only identify those who may be using a different version of the software, but to explain that not everyone will have the same functionality if they are using different versions.  This is a big one for minimizing errors.

Why and how to comment: Why? Introducing students to commenting on their code will help you as an instructor (to identify their thought process) and will also aid in the learning process (students have to articulate the purpose of each line or a few lines of code, and what these lines achieve.

Debugging: Why? Learning how to diagnose the source of an error and identify an approach to arriving at a solution is central to the process of writing and executing code.  This will likely involve introducing students to the process of identifying an error code (and what it may mean), determining what components of a line of code are working versus failing (by running portions of the code at the command line), and using search engines to aid in finding a solution.

 

Have an idea that’s not on this list? Please let us know, along with your webpage and/or twitter account, so we can give you credit!