Abstract
Computational thinking is an approach to problem solving that is typically employed by computer programmers. The advantage of this approach is that solutions can be generated through algorithms that can be implemented as computer code. Although computational thinking has historically been a skill that is exclusively taught within computer science, there has been a more recent movement to introduce these skills within other disciplines. Psychology is an excellent example of a discipline that would benefit from computational thinking skills because of the nature of questions that are typically asked within the discipline. However, there has not been a formal curriculum proposed to teach computational thinking within psychology and the behavioural sciences. I will argue that computational thinking is a fundamental skill that can easily be introduced to psychology students throughout their undergraduate education. This would provide students with the skills necessary to become successful researchers, and would also provide a practical and marketable skill to all psychology graduates.
Introduction
Computers are fundamental to nearly all aspects of psychological research. From literature searches to statistical analyses, the modern-day psychology student will use computers at most (if not all) stages of their undergraduate careers. Because of this ubiquity, most students will ideally develop strong computer literacy skills throughout their education, learning to use applications such as SPSS, Excel, and Google. Although computer literacy is an important skill for students to develop, it does not encompass the broader range of computer skills that are becoming increasingly important in the current job market (Davies, Fidler, & Gorbis, 2011). To fulfill this growing demand, there has been a resurgence of interest in computer science education across all levels of schooling. For example, national curricula for teaching the fundamentals of computer science from K-12 are being developed in both the U.S. and the UK. At the post-secondary level, undergraduate courses that focus on developing programming skills for majors outside of computer science are becoming increasingly popular (e.g., Greher & Heines, 2014; Hambrusch, Hoffman, Korb, Haugan, & Hosking, 2009; Rubinstein & Chor, 2014). With the prevalence of computers and computational methods in many areas of psychology, programming skills can (and should) be introduced into the psychology curriculum as well.
The most important skill that a new programmer needs to acquire is the ability to think like a computer scientist. This way of thinking is referred to as computational thinking, which is an analytical approach to problem solving that has been historically used within computer science (Wing, 2006). Computational thinking is geared towards developing solutions for open-ended problems following a series of formalized steps. These steps emphasize concepts that are central to computer science, such as iteration, abstraction and automation (Wing, 2008). When used appropriately, following a computational approach will yield comprehensive solutions to problems that are optimized for efficiency. In addition, some evidence suggests that computational thinking skills transfer to more general problem-solving, and metacognitive abilities (e.g., Ismail, Ngah, & Umar, 2010; Lye & Koh, 2014). Although computational thinking is a skill that is required to learn how to program, programming is
Open-ended problems are problems that can be solved through multiple potential solutions. Because many problems in psychology are by nature open-ended, psychology is a field that naturally lends itself to a computational thinking approach. For example, scientific research questions are excellent examples of open-ended problems (DeMeo, 2008). The goal of the researcher is to obtain data that answers some pre-defined theoretical question. In order to achieve this goal, the researcher needs to devise a series of well-formulated steps to acquire that data. A computational thinking approach can be used to systematically plan the steps that are required for data to be collected, and ensure that the research plan is designed as efficiently as possible. Although some of these steps are implicitly learned through experience, providing an explicit framework to follow when developing research paradigms should accelerate this learning process. Computational thinking provides an excellent framework in this sense.
The Steps of Computational Thinking
The computational thinking approach consists of 5 major steps, each of which is a fundamental skill that is useful for research design (Csizmadia et al., 2015). The first step,
Decomposition
Most open-ended problems are inherently complex, and would be unwieldy for a problem solver to deal with holistically. To simplify the process, the problem solver needs to identify sub-problems that can be handled more efficiently. Each sub-problem can then be solved individually, or decomposed further depending on the complexity of the sub-problem. In research design, for example, researchers do not typically approach experimental questions holistically. Instead, the researcher will break the problem into a series of “smaller” issues that can be approached systematically. Issues such as the type of research design that will be used, the demographics of the subjects to be tested, and the types of stimuli that will be presented, are all examples of sub-problems that can be decomposed from the overall research question. The more detailed that the researcher can be with the decomposition process, the better it is for designing a series of well-formulated steps for the solution to be achieved.
Pattern Recognition
The next step in the computational thinking process is pattern recognition. Here, the problem solver needs to take the sub-problems that have been identified, and look for patterns of information throughout those problems. A pattern, in this context, reflects any type of information that repeats itself. The pattern could be physical (which could describe some stimuli that might be designed), or it might be more conceptual in nature. In research, for example, there will be a pattern that describes what should be presented from trial to trial, and the researcher needs to identify precisely what that pattern is. Once a pattern has been identified, the problem solver can then develop a solution to a single iteration of the pattern. Once that solution has been developed, it can then be applied to
Abstraction
The third step of computational thinking involves generating an abstract representation of the pattern once it has been identified. To this end, the problem solver needs to filter out the details of the pattern so that a generalized representation of the pattern can be used to solve the problem. For example, once a pattern for trial generation has been identified, the researcher needs to generalize that pattern so that it can be used as a “blueprint” for what should occur in each trial. At this stage, the problem has now been represented symbolically, and that symbolic representation can be applied to any situation where the pattern is observed. The abstracted pattern that results from this stage of computational thinking in effect becomes a model that represents all iterations of the pattern.
Algorithm Design
Once an abstract representation of the pattern has been generated, the problem solver then designs an algorithm to generate an iterative solution to the problem. An algorithm is a series of explicit instructions that need to be followed in order to achieve some goal. An example of an algorithm in psychological research would be a control flow of events that define what occurs during an experiment. Algorithms always begin with a defined start-point and a defined end-point, and the problem solver determines the series of steps that need to be followed to get from start to finish. In computer science, the algorithm is generated as a series of coded steps that is created by the programmer. However, programming is not a necessary requirement for an algorithm:
The most effective method for organizing algorithms is through the use of a flow chart. A flow chart contains a series of symbolic representations of steps that provides a visual representation of the control flow of a process. All flow charts possess a start state, an end state, and some series of steps that should be executed in the prescribed order. Each step is defined using different shapes: for example, start and end states are typically represented with ovals, processes are represented with rectangles, and decisions with diamonds (Figure 1). Each step is executed in the order that is indicated by the flow line (arrow), which indicates the direction of control (a full list of standardized symbols for flow charts is provided in Rossheim, 1963). One of the benefits of using a flow chart to represent control flows is that if there is a fundamental problem in the logic of the algorithm, this will be highlighted when represented as a flowchart. As such, flow charts are handy tools for problem solvers.
Common symbols that are used in flowcharts. Each symbol represents a procedural step that typically occurs in common control flow processes.
Evaluation
The final step in the computational thinking process is evaluation of the algorithm. Once the algorithm has been generated, it is extremely important to ensure that the algorithm contains all of the necessary steps that are required to solve the problem. If an algorithm is designed for an experiment, for example, the researcher should walk through the experiment step-by-step to ensure that all of the requisite processes are included. A problem in the algorithm might invalidate the product of the algorithm; therefore, it is very important that the problem solver test the algorithm methodically and systematically. To accomplish this, the problem solver should ensure that the algorithm is comprehensive (i.e., contains all required steps for the solution) and efficient (i.e., does not contain any unnecessary steps). In computer science, this stage of programming is referred to as the “debugging” stage. Only once this stage is complete can the problem solver be sure that they have developed a comprehensive solution to the problem at hand.
Applying Computational Thinking in the Classroom: An Example
A computational thinking approach will benefit any open-ended type of problem solving. One of the most prolific examples of an open-ended problem in psychology is found within research design. The types of research questions that are typically asked in psychology are open-ended, thus computational thinking provides a framework for developing solutions to these research questions. An added benefit in using a computational thinking approach in research is that many experiments are now conducted using computers. If a computational thinking approach is used for developing research solutions, then those solutions are by nature formulated in a way that makes them easier to implement by computer.
Computational thinking can be easily introduced in any course where students are required to design their own experimental paradigms to answer open-ended research questions. This type of assignment is typical in many research methods courses, or upper-level laboratory or seminar courses (e.g., Saville, 2008). For example, an instructor might ask their class to design an experiment to determine whether emotional responses can be primed through exposure to other emotional stimuli. This is an open-ended problem, and the goal for the students is to design a solution to the problem (i.e., design the experiment). This can be accomplished by following the 5 steps of computational thinking.
Following a computational thinking approach, the students first need to decompose the problem into a series of manageable parts. To determine whether or not emotional priming exists, a series of sub-problems first need to be identified and considered. This can be accomplished through a brainstorming period, where the students generate a list of smaller issues that need to be considered and/or solved before the experiment can be conducted. Some examples of sub-problems that might arise during this process may include (but are not limited to) the following.
How will priming be evaluated? What types of stimuli will be used? What will happen from trial-to-trial? How will the data be analyzed? How many subjects should be tested?
This list is not meant to be exhaustive, and of course students can and should generate as many detailed issues that need to be considered before the experiment can be designed.
Many of these issues can be dealt with directly, and do not require a computational approach per se. For example, determining the number of subjects that should be tested will be based either upon the standards within the literature or some other sampling criterion. This is
For the next step of computational thinking, pattern recognition, the students need to look for information that repeats itself within the problem to be solved. An excellent example of a pattern in psychological research is contained within the experimental trials. The events that occur in each trial will follow the same pattern, and the students need to determine what this pattern will be. For a priming experiment, each trial will be both the prime and the test stimulus to be presented. There also needs to be a fixed period of time between the prime and the test stimulus (i.e., the inter-stimulus interval, or ISI), and some point during which the response of the subject is recorded. The temporal order of all of these events will follow the same pattern, which can then be used to determine a common solution for what needs to be presented from trial-to-trial.
The third step of computational thinking is abstraction, where the details of the pattern are filtered out. With respect to the temporal order of events within a trial, this simply means that the students generate a model that can be used to describe what will happen in each trial. Details such as the stimuli that will be used, the emotions that will be tested, and the congruency of the emotions between the prime and test stimuli can be disregarded at this stage. To this end, an abstract representation of the order of events in each trial might appear as: Prime → ISI → Test → Response
The fourth step involves using the abstracted pattern as a framework to develop an algorithm that determines the events in each trial of the experiment. The model must be applied to each trial of the experiment, thus an iterative component must be included in the algorithm. Iteration is reflected as a loop in the logical progression of a flow chart, which terminates once some threshold level has been reached. In Figure 2, the decision to terminate the process relies on the decision as to whether the number of trials has reached 100, and the algorithm will iterate through the presentation until that number has been reached. At this point, the algorithm is now presented in a way that is conducive for programming: for students who know how to program, the overall process is laid out in such a way that it is easy to translate into a programming language. However, even without translating the algorithm into computer code, the exercise of developing an algorithm to describe the application of a process is still a valuable problem solving skill to develop. The result of this process is an efficient solution that can easily be implemented by computer.
An example of a flowchart that represents the control flow of a priming experiment. The processes highlighted in grey represent the events that occur during each trial. The algorithm is designed to present the trial events for 100 trials.
The final step for the students in the computational thinking process is evaluating the validity of the algorithm. Although this step of computational thinking is not as involved as the other steps, it is nonetheless imperative that the students evaluate whether or not their algorithm works. This requires going through the algorithm and ensuring that the solution is error-free, comprehensive, and as efficient as possible. In the example presented here, students need to ensure that their algorithm will present the stimuli in the same order for all 100 trials. If there are mistakes, they should be caught at this stage of the problem solving process. Once this is completed, the final product should represent a solution to the problem that is optimized for efficiency.
Conclusions
Here, I have summarized the steps of computational thinking and one example of how this problem solving framework can be introduced within the psychology curriculum. This is only meant as a brief introduction to computational thinking: several recent textbooks present a more comprehensive discussion of computational thinking for non-computer scientists (e.g., Riley & Hunt, 2014; Wang, 2015). The reader is encouraged to consult these sources for more concepts that can be introduced into their classrooms. Although I have discussed only one example of a process in psychology that would benefit from a computational thinking approach, there are many other practical applications of computational thinking that can be used as well. Determining the stimuli will be presented in each trial, designing certain kinds of stimuli, or even reorganizing data for statistical analysis, are only a few examples of processes that could be optimized through computational thinking. Computational thinking, by nature, is a skill that encourages an ingenuity that can be used to develop new and creative solutions to problems in psychology.
Beyond the practical application of computational thinking in psychology, students will benefit more generally by developing these skills as well. Computational thinking is quickly gaining traction as a fundamental skill that will be required in the future, much like reading, writing, and arithmetic (Lu & Fletcher, 2009; Wing, 2006). For students who are interested in pursuing a career in research, many will be required to learn how to program at some point in their academic career. Teaching these students the fundamentals of computational thinking is paramount to developing more general programming skills. Outside of academia, computational thinking is an invaluable skill for a range of careers, from those that require creative problem solving (e.g., consultants) to those that involve big data (e.g., market research analysts). Computational thinking is a skill that will benefit our students regardless of their career trajectories.
Footnotes
Declaration of Conflicting Interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) received no financial support for the research, authorship, and/or publication of this article.
