Society for the Teaching of Psychology: Division 2 of the American Psychological Association

Learning content while learning to code

23 Jan 2023 9:18 PM | Anonymous member (Administrator)

Michael Dubois
(University of Toronto)


While preparing to teach a course for the first time, I was keenly aware of the little time I had with students, and the consequent limits in how much material I could reasonably cover. Doubtless, many other instructors find it difficult to narrow down which topics can be included in a course, and to what degree of detail. Relatedly, scientific publications are being produced at ever-increasing rates, with the total sum of publications in the hundreds of millions (often languishing unread in piles on desks and desktops). With such a volume of extant literature, it is simply not feasible to cover everything.

Complicating the dilemma between time and the quantity of facts is the increasing demand for students to learn skills (as found in “Psynopsis: Education Issue,” 2021).

Skills-based education is critical in supporting students after graduation: more than 1-million undergraduates take introductory psychology each year (Gurung et al., 2016), but nearly 60% of psychology graduates do not obtain further education. Furthermore, around 50% of those graduates will obtain careers in sales, marketing, management, and other businesses where there is little need for specific course-related information (Carnevale, Gainer, & Meltzer, 2020), but greater demand for general cognitive and technical skills.

The American Psychological Association’s Committee on Associate and Baccalaureate Education (CABE) reports that employers are interested in employees with skills across 5 broad domains: cognitive, communication, personal, social, and technological (Appleby et al., 2019; Hettich, 2021).

Thus, while instructors need to carefully choose materials relevant to the course, they must simultaneously consider how their teaching addresses the broader needs of students—both within individual courses, and beyond university life. I contend that instructors must creatively find ways to “double dip”—presenting course content via pedagogical methods that concurrently develop students’ professional skillset.

Specifically, teaching students computer coding skills and giving them the opportunity to practice those skills in class are useful ways of presenting course materials in an engaging way, and fostering the mastery of practical and employable skills. 

By “computer coding,” specifically, I am referring to the use of text-based computer code in collecting, combining, cleaning, analyzing, and visualizing experimental psychology data. In my practice, this takes the form of using the R programming language (R Core Team, 2019): a data file (CSV format) containing behavioural responses for one participant are combined into a single larger file; this larger file is then cleaned and prepared for further analysis; finally, variables are compared (descriptively and inferentially), and presented in a graphical format. 

How would this look in practice?

Implementing coding in class can be extremely flexible, and tailored to meet the desires of students and instructors alike. An effective “crash course” can take as little as a single class, with more substantial integration lasting the duration of a course.

One technique I recommend is allowing students to find data (class-relevant, and personally interesting) to explore themselves. For instance, a student in developmental psychology could find data for child behaviours to compare with adults.

In all cases, early instruction should cover the particular programming language and syntax that students will use, and how to acquire the relevant software. Students can be briefly taught how to perform basic operations on data in furtherance of answering a research question. Finally, instructors should demonstrate how to use online resources to extend their basic knowledge of coding.

What pedagogical goals can coding support?

Including any degree of coding provides at least an initial step toward facilitating students’ mastery of skills and future employability: this includes both the technical skill of coding, and the cognitive skills that coding demands (e.g., developing questions, selecting analysis methods, interpreting results). Such cognitive skills are directly relevant to student learning and performance outcomes (Krain, 2010).

Importantly, there are also many pedagogical benefits associated with implementing coding in class.

Here I emphasize three of the APA’s Principles for Quality Undergraduate Education in Psychology (2011):

Principle #1: Students are responsible for monitoring and enhancing their own learning.

The approach I have proposed is empowering for students. First, they choose a dataset and determine what variables it contains, and what question(s) to answer. Next, they must extend a (presumably) cursory knowledge of coding skills to answer their question. Importantly, errors offer a critical opportunity reflect and adapt. Finally, students should be encouraged to present their work to peers (or other non-experts). Many programming languages include methods for producing polished “reports” (e.g. Rmarkdown, Jupyter Notebooks)—these make an excellent class assignment or final project, and emphasize communicating knowledge.

Together, students are primarily responsible for each step throughout the coding process, with instructors only helping to guidance/direct thereafter. By assuming responsibility, students will be more invested and interested in the material they encounter; student interest is a key predictor of many positive outcomes—from motivation and effort (McManus, 1986a, 1986b), to learning and retention (Lester, 2013; Subramaniam, 2009).

Principle #2: Faculty strive to become scientist–educators who are knowledgeable about and use the principles of the science of learning.

Like any skill, mastery of coding requires multiple practice sessions. Helpfully, one of the most robust and evidenced pedagogical principles is that repeating and distributing learning over time is linked to greater learning (Delaney, Verkoeijen, & Spirgel, 2010). Thus, instructors should consider assigning multiple coding exercises—whether different analyses of the same data, or exploring new data all together—to support students’ mastery of the coding skill, and also learning course content.

The approach I describe has a large overlap with principles of “active learning”—the idea that students learn more when they are participants in learning, and not merely passive recipients (Nelson, 2008; Park et al., 2021). Indeed, active participation is one of the fundamental elements of coding instruction from training organizations such as The Carpentries (Atwood et al., 2019).

Principle #3: Psychology departments and programs create a coherent curriculum.

As noted by the APA’s Introductory Psychology Initiative (IPI), the varying domains of psychology are linked by a common foundation of scientific inquiry (The American Psychological Association (APA), 2021). This common foundation is often only taught in research methods classes (or not at all), which can leave students with a tenuous understanding of the higher-order processes that unite the field of psychology. I propose that including coding in multiple psychology classes, even to a minimal degree, can help bridge this conceptual gap.

Additionally, by implementing coding early and often in a curriculum, students are able to take concepts and skills acquired in lower-level classes and further develop them during upper-level classes (another form of distributed practice).

Finally, the IPI notes that a high-quality curriculum should include an “integrative/capstone experience,” and emphasizes the acquisition of knowledge & skills that are directly relevant to students’ lives. I propose that a thorough and rigorous analysis of data is an excellent example of such an activity!

This has often been (partially) accomplished via honours thesis projects, however, knowledge of coding introduces several alternatives: having students analyze data collected by faculty, partnering with community organizations to analyze their data, or reanalyzing previously published datasets. Learning (both the coding skill, and the psychological content) benefits when the learning is related to real-world applications and problems (Yurco, 2014).

Coding concerns

Before concluding, I thought it important to address several concerns that instructors and/or students may have.

Given this approach to teaching is necessarily technical (in fact, having students acquire the technical skill is one of the primary goals), consideration should be given to both hardware and software.

First, hardware (computers) is required, but this can take many forms: including student-owned laptops, or institutional computers (library, computer labs, etc.). Most data analyses have fairly low graphical and computing demands, meaning that essentially any computer is suitable.

Second is software. Many extremely popular coding languages (R, Python) operate in software that are fully functional and open-source (i.e. free). The only requirement is access to an internet browser and sufficient computer memory to download the program.

More recently, cloud-based computing environments (Posit Cloud, Jupyter Notebook) have been developed as alternatives to locally stored software, which allows for all students and instructors to share a single technical space and avoids many of the technical conflicts that occur due to different operating systems, software versions, packages, etc.

Another potential concern relates to the limited level of familiarity and expertise in coding that students (and instructors for that matter) may bring into the class. On one hand, I believe this concern could be applied equally well to limited knowledge of course material. Still, different coding languages vary a great deal in their perceived levels of difficulty. As such, when deciding how to integrate coding into classes, instructors should consider what level of difficulty students can reasonably manage, given their abilities.  

Moreover, students and instructors should be reassured that they will be supported in learning to code with an abundance of online resources. Although open-source software does not come with access to formal support services (like a “help desk”), they are often rooted within vibrant communities who share documents, guides, example code, workshop materials, videos, and even forums to discuss problems and solutions. Instructors should seriously consider which supports they intend to use (and share with students) in order to provide maximal scaffolding during the learning process.

Lastly, I will address student assessment—in terms of both the format and content.

Given the flexibility instructors have in implementing coding, there is similar flexibility in the format of student assessment. For instance, instructors can still use traditional written exams containing standard question formats (multiple-choice, true-or-false, etc.). Conversely, instructors can emphasize more advanced assessment types such as completing code exercises (fill-in-the-blanks, or open-ended), giving presentations, or producing analysis reports.

Regarding the content of class assessments, I suggest following the APA’s emphasis on transferable skills (Appleby et al., 2019). For instance, communication skills can be assessed by having students give presentations or write reports on their analyses; critical thinking can be assessed by having students explain their decision-making processes when choosing between different analysis options; information management ability can be assessed by having students explain how they interpret their analysis findings.

Conversely, coding skills should not be the primary focus of assessment. First, many different coding solutions achieve the same outcomes (making grade assignment difficult). Second, given the dynamic and ever-evolving lifecycle of code and packages, it is not important to assess the particular syntax students use (so long as it is of practical utility).

Importantly, including any of these assessments do not preclude assessing course facts and concepts. Instead, it simply shifts the emphasis of learning outcomes being measured to provide greater balance between course content and skills. 


Let us return to the original instructor’s dilemma: covering all of the relevant facts and findings is likely impossible, given the finite contact hours with students. This is especially true when considering the need to teach students the cognitive and technical skills they will need later in life.

I suggest that we can resolve (or at least address) this dilemma by using coding as the fundamental medium by which students engage the key concepts of psychology. This will help support students develop their ability to explore and evaluate data (conceptually and practically), while still exposing them to the key ideas and class material. Moreover, this approach leverages multiple pedagogical principles (distributed practice, active learning) that are known to improve student learning outcomes.

The general nature of coding, and the increasing availability of online data and supporting resources, make this endeavour quite feasible—while still offering significant flexibility to the varied needs of institutions and individuals.  

Take a moment to ask yourself this question: “what do I want my students to remember in five years?” Whatever your answer, how can you make that outcome a reality? Including elements of computer coding may be an effective means to that end.


Appleby, D. C., Young, J., Kirk, J. Van, Rudmann, J., Naufel, K. Z., Spencer, S. M., … Richmond, A. S. (2019). Transferable Skills: The Skillful Psychology Student. American Psychological Association.

Atwood, T. P., Creamer, A. T., Dull, J., Goldman, J., Lee, K., Leligdon, L. C., & Oelker, S. K. (2019). Joining Together to Build More: The New England Software Carpentry Library Consortium. Journal of EScience Librarianship, 8(1), e1161.

Carnevale, A. P., Gainer, L. I., & Meltzer, A. S. (2020). Workplace Basics: the competencies employers want. Retrieved from

Delaney, P. F., Verkoeijen, P. P. J. L., & Spirgel, A. (2010). Spacing and Testing Effects: A Deeply Critical, Lengthy, and At Times Discursive Review of the Literature. Psychology of Learning and Motivation - Advances in Research and Theory (1st ed., Vol. 53). Elsevier Inc.

Gurung, R. A. R., Hackathorn, J., Enns, C., Frantz, S., Cacioppo, J. T., Loop, T., & Freeman, J. E. (2016). Strengthening introductory psychology: A new model for teaching the introductory course. American Psychologist, 71(2), 112–124.

Hettich, P. (2021). What Skills Do Employers Seek? Four Perspectives. Eye on Psi Chi Magazine, 26(1), 20–24.

Krain, M. (2010). The effects of different types of case learning on student engagement. International Studies Perspectives, 11(3), 291–308.

Lester, D. (2013). A review of the student engagement literature. Focus on Colleges, Universities, and Schools, 7(1), 1–8.

McManus, J. L. (1986a). “Live” Case Study/Journal Record in Adolescent Psychology. Teaching of Psychology, 13(2), 70–74.

McManus, J. L. (1986b). Student Composed Case Study in Adolescent Psychology. Teaching of Psychology, 13(2), 92–93.

Nelson, C. E. (2008). Teaching evolution (and all of biology) more effectively: Strategies for engagement, critical reasoning, and confronting misconceptions. Integrative and Comparative Biology, 48(2), 213–225.

Park, E. S., Harlow, A., AghaKouchak, A., Baldi, B., Burley, N., Buswell, N., … Sato, B. (2021). Instructor facilitation mediates students’ negative perceptions of active learning instruction. PLoS ONE, 16(12 December), 1–16.

Psynopsis: Education Issue. (2021). Psynopsis, 43(3). Retrieved from

R Core Team. (2019). R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. Retrieved from

Subramaniam, P. R. (2009). Motivational Effects of Interest on Student Engagement and Learning in Physical Education : A Review. Int J Phys Education, 46(2), 11–20.

The American Psychological Association (APA). (2011). APA Principles for Quality Undergraduate Education in Psychology. The American Psychological Association (APA).

The American Psychological Association (APA). (2021). APA Introductory Psychology Initiative (IPI) Student Learning Outcomes for Introductory Psychology. The American Psychological Association, (OCTOBER), 2021. Retrieved from

Yurco, P. (2014). Student-Generated Cases: Giving Students More Ownership in the Learning Process. Journal of College Science Teaching, 043(03), 54–58.

Powered by Wild Apricot Membership Software