Abstract
Programming and computational thinking have emerged as compulsory skills in elementary school education. In 2018, Sweden has integrated programming in mathematics education with the rationale that it fosters problem solving and logical thinking skills and motivates students to learn mathematics. We investigated how teachers introduce programming in mathematics education in a Swedish primary school using an explorative case study. We followed four mathematics teachers during the first semester in which programming was mandatory. They taught second-, sixth- and ninth-grade students. Our contributions are threefold: we provide an account of how programming is taught in mathematics education; we discuss how teachers reflect on the challenge of teaching programming in mathematics; and we report on students’ understanding of programming and their view on the relationship between programming and mathematics.
Introduction
Most European countries have integrated programming or computational thinking in their curriculum or plan to do so in the nearest future (Balanskat et al., 2017). In Sweden, there has been an updated curriculum with a focus on digitalization in all subjects since July 2017. Programming has been integrated as central content in mathematics and technology classes for primary schools (‘Digital kompetens – Skolverket’, n.d.), mandatory since autumn 2018. So far, there is little research available exploring how this new policy has been deployed in schools in practice. It is important to investigate how teachers understand the relationship between programming and mathematics, as well as how they include programming in mathematics teaching. In their review, Forsström and Kaufmann (2019) state that a ‘need exists for a better understanding of how programming is politically conceptualized and how these conceptualizations constitute educational practice’.
The purpose of this study is to explore how teachers implement the adjustments in the new curriculum, both to provide an account of educational practice and to highlight difficulties and problems that arise. It offers a valuable guide for other countries, such as Norway, which will introduce programming into the mathematics curriculum by 2020 (‘Fagfornyelsen’, n.d.). This article therefore contributes to a better understanding of the deployment of the Swedish programming curriculum by considering the following research question: How do teachers introduce programming in mathematics education in a Swedish primary school? In order to operationalize this undertaking, we formulated four sub-questions:
How do teachers describe their acquirement of programming knowledge? How do teachers teach programming in mathematics lessons? How do teachers describe their teaching of programming in relation to the mathematics curriculum? How do students describe the relationship between programming and mathematics?
Our focus lies on teachers’ practice and their reflection on their practice. However, we included students as well, to obtain insights on how teachers' understanding of programming in relation to mathematics is verbalized in the classroom. In the following section, we will present a short overview on the Swedish curriculum, teachers’ further education opportunities in Sweden, as well as related work on programming and mathematics. We continue by presenting our case study, including choice of methodology and methods, implementation and results, before answering our research question and providing a set of action points, suggested by the involved teachers. Lastly, we present our conclusion.
Background
The term programming is loosely defined in the Swedish curriculum, reaching from computational thinking to digital citizenship (Bocconi et al., 2018). The Swedish curriculum includes programming as part of digital competences, described as writing code and problem solving (problem formulation, choosing a solution, trying and retesting and documenting). According to the National Agency for Education, ‘programming should be viewed in a wider perspective, that also includes creative creation, governance and regulation, simulation and democratic dimensions. This broader perspective on programming is seen as an important foundation in all teaching and thus, programming shall be included in all aspects of digital competence’ (‘Få syn på digitaliseringen på grundskolenivå – Skolverket’). The adoption of programming especially in the mathematics curriculum is based on the argument that programming can support problem solving and logical thinking, both important skills for mathematics, as well as the overall aim to avoid a new subject (Bocconi et al., 2018; Education (CECE), 2017). So far, there is scattered research that demonstrated how programming can support teaching mathematics. In their review, Forström and Kaufmann (2019) find that several studies indicate students’ positive development in problem solving and logical thinking, but that results vary and are not generalizable. In our study we investigate the Swedish model of teaching programming in mathematics based on:
Loewenberg Ball et al.’s mathematical knowledge for teaching; Swedish mathematics curriculum describing programming content knowledge; further education for teachers in Sweden to acquire programming content knowledge.
Mathematical knowledge for teaching
Loewenberg Ball et al. (2008) developed a model describing mathematical knowledge for teaching based on Shulman’s (1986) initial categories: subject matter knowledge and pedagogical content knowledge. They divided the teacher's competencies into five areas (see Figure 1). Subject matter knowledge, on the left side in the model, contains common content knowledge (CCK) and specialized content knowledge (SCK). CCK is mathematical knowledge that well-educated adults are expected to know, such as how to use calculation to obtain the right answer. In other words, ‘it is the knowledge teachers need in order to be able to do the work that they are assigning their students’ (Loewenberg Ball et al., 2008). SCK is mathematical knowledge specific for the teaching profession beyond that expected of any well-educated adult, without requiring knowledge of students or knowledge of teaching. Experienced teachers can utilize different methods and representations to calculate a solution, needed to be able to understand students' different thoughts and mathematical reasoning. According to this definition, we define subject matter knowledge for programming as the ability to solve mathematical problems using computational thinking and programming (CCK), and the knowledge of different programming strategies, including their differences and similarities (SCK).

Loewenberg Ball et al. (2008) model of mathematical knowledge for teaching
The right side of the model is labelled pedagogical content knowledge, containing knowledge of content and students (KCS), knowledge of content and teaching (KCT), and knowledge of curriculum. KCS is a type of pedagogical content knowledge that combines ‘knowing about students and knowing about mathematics’ (Loewenberg Ball et al., 2008). KCS derives from experience with students and knowledge of their thinking, including students’ common errors. In close relation, KCT is knowledge that combines ‘knowing about teaching and knowing about mathematics’ (Loewenberg Ball et al., 2008). Experienced teachers know how to sequence instructions to teach a mathematical idea, for instance, ‘deciding which example to start with and which examples to use to take students deeper into the content’ (Loewenberg Ball et al., 2008). Interpreting this definition to programming, we define pedagogical content knowledge as the understanding of students’ common programming errors, their conception of computational thinking and their motivation and interest in programming (KCS); the competence to teach programming (KCT); as well as knowledge of the mathematics curriculum that relates to programming.
Swedish mathematics curriculum
The Swedish mathematics curriculum is organized in three parts: overall purpose, central content, and proficiency. Programming is included in the overall purpose as follows: Furthermore, the students will be given the opportunity to develop knowledge in using digital tools and programming in order to be able to investigate problems and mathematical concepts, to make calculations and to present and interpret data. (‘Kursplan – Matematik (Grundskolan) – Skolverket’) formulate and solve problems using mathematics and evaluate selected strategies and methods; use and analyse mathematical concepts and relationships between concepts; select and use appropriate mathematical methods to do calculations and solve routine tasks; conduct and follow mathematical reasoning; use mathematical forms of expression to discuss, argue and account for issues, calculations and conclusions. (‘Kursplan – Matematik (Grundskolan) – Skolverket’)
Programming is added to the mathematical area ‘algebra’ for all grades in primary school, as well as a part of central content ‘problem solving’ for grades 7–9. Problem solving is described both as a skill and a central content in the curriculum. In the following, we list central content including programming by grade:
Grades 1–3: Algebra
How unambiguous step-by-step instructions can be constructed, described and followed as a basis for programming. Use of symbols in step-by-step instructions.
Grades 4–6: Algebra
How algorithms can be created and used in programming. Programming in visual programming environments.
Grades 7–9: Algebra
How algorithms can be created and used in programming. Programming in different programming environments.
Grades 7–9: Problem solving
How algorithms can be created, tested and improved in programming for mathematical problem solving. (‘Kursplan – Matematik (Grundskolan) – Skolverket’)
Programming further education for teachers in Sweden
The introduction of programming in the curriculum calls for major in-service teacher training initiatives to upscale competences (Bocconi et al., 2018). The National Agency for Education in Sweden has promoted several initiatives to provide teachers with programming knowledge and enable them to teach the new central content in the curriculum, including a MOOC in basic programming (‘Om programmering – webbkurs – Skolverket’), teachers’ conferences and webinars. However, few teachers have received adequate education during the first year of deployment. There is a danger that programming is taught by teachers who do not have the appropriate subject matter knowledge. Bocconi et al. (2018) list two important aspects for acquiring programming competences:
Social media plays a key role in disseminating good practices among teachers. The commitment of schools and local education authorities is important in creating the conditions (e.g. leave time, substitutions) for securing teachers’ participation in training initiatives.
Furthermore, they found evidence that the transfer of programming skills is more likely to happen when all teachers are able to participate, and when programming is connected to the pedagogical approach adopted in the classroom (Bocconi et al., 2018).
Our approach
How do teachers introduce programming in mathematics education in a Swedish primary school? We chose to investigate this question with an approach that might be characterized as qualitative, inspired by ethnomethodology (Have, 2004), beginning with practice, because it seemed obvious to study how teachers teach programming in the classroom, as well as how they reflect on teaching programming in relation to mathematics.
Method
We approach the research question through an exploratory case study. Exploratory case study is a qualitative research method with an open and exploratory mindset where one or multiple cases within a specific context are investigated (Thomas, 2015; Yin, 2003). Case study focuses on studying organizations, events and activities within its specific context, aiming to link theory to practice. In this way, it provides practical evidence to test, support or refute existing theory, as well as to develop new theory. Therefore, case study is particularly useful in answering ‘how’ and ‘why' questions, as well as identifying problems and best practices in context. In our case study we collected data in two ways. First, we conducted non-participant observations of teaching practice. Second, we carried out a series of semi-structured interviews with both mathematics teachers and students.
During autumn 2018, we followed programming lessons that were part of the mathematics subject for three classes (second grade, sixth grade, ninth grade), each from a different primary school in a Swedish small town. Autumn 2018 was the first semester in which the new curriculum was mandatory for all schools. We selected one classroom case for each of the proficiency groups defined in the Swedish mathematics curriculum. We visited the classes beforehand to explain the purpose of our study and give students the opportunity to get to know us. We recruited four teachers (second-grade class had two mathematics teachers) and 14 students for interviews. All four teachers have had some form of further education in programming and were described by their principals as interested in programming. This was a conscious decision, to ensure that they actually taught programming in mathematics during the semester. The students were selected randomly from provided class lists before classroom observations. All teachers as well as students and their parents were provided written information about the study and they gave their written consent to participate in the study.
In total, we conducted six non-participant observations (we visited ninth grade for three 1-hour lessons, sixth grade for one 2-hour lesson and second grade for one 2-hour lesson). One of the researchers sat at the back of the classroom and took notes on what happened in the room and how the class worked with programming. On some occasions, the researcher had to explicitly request students to seek help from the teacher instead of him. We are aware that these observations were biased through the observer effect, but they were vital for us to understand what happened in the classroom and to prepare for the interviews. We conducted semi-structured interviews with all four teachers in conjunction with the observations, lasting about 30 minutes each, to collect information on lesson plans and reflection, as well as insights about their understanding of programming. The semi-structured interviews with students were conducted after attending the programming lessons and lasted between 10 and 30 minutes.
All interview data was transcribed and read several times by both researchers to get an overview of the data. We used open coding to analyse both interview data and observational notes independently from each other, followed by a collaborative session where we resolved differences and agreed on the main findings, as suggested by Bryman (2012). Both researchers are from different scientific fields (teaching education and computer sciences) and coded the data from their perspective.
Findings
We grouped the information from both interviews and observations using the defined sub questions.
How do teachers describe their acquirement of programming knowledge?
A key role, preparing for the new programming curriculum, played a local one-day introductory programming workshop for all mathematics teachers organized by the municipality in early 2018. One teacher in particular, working with second-grade students, was concerned how she could introduce programming for young children before the workshop. She described that she felt anxious about teaching programming, ‘because this was just something abstract [she] didn't know anything about’. The workshop helped her to understand programming as giving a robot step-by-step instruction on how to move on a game plan and thereby connect the new central content of the curriculum to a concrete programming example that she could implement in class.
Another important source of information is the internet. All four teachers have searched and found inspiration on various websites, Facebook groups or blogs about programming in the school. However, none of the teachers mentioned the web course provided by the Swedish National Agency for Education. One teacher describes how she used the internet to find out more about programming: The first time I searched for information on programming was before Hour of Code, there our preschool class participated. Afterwards I started to explore more what programming was all about, but there was so terribly lot of information to choose from. It was difficult to know, what was suitable for preschool students, 6 years of age. So that year we did nothing … Another time by chance, I found the program Light-Bot, which I used for older students in four, five and six, and they were completely sold, and they went on and on like this.
Collegial support for filtering and sharing information about programming has been important. Several teachers mentioned the importance of being part of a local network that has an interest in IT and programming at school. In these networks, ideas and tips emerge and are shared and different examples for teaching programming in mathematics are discussed.
One teacher mentioned her previous teaching experience using spreadsheets for calculating volumes of different geometric bodies. Prior the new curriculum, she did not consider creating formulas in spreadsheets to be programming. Now she clearly states that it is related to programming, which she interprets as ‘giving computer instructions’.
The interviewed teachers demanded more teaching materials for programming, adapted to the new mathematics curriculum, as an additional source for programming knowledge. They have looked through new editions of mathematics school books containing programming tasks and bought adjacent teaching material containing suggested lesson plans. They emphasized that students can easily follow the provided example tasks without additional instructions.
How do teachers teach programming in mathematics lessons?
The teachers in second grade stated that they understand programming as providing step-by-step instructions. This was manifested by the exercises they have chosen for programming lessons. One example exercise was a clapping chant. The students worked in pairs, standing opposite each other. They started by counting to three in turns: one started to count ‘one’, then the other said ‘two’, then the first said ‘three’, and the second started over with ‘one’ and so on. After practising a few times, the students clapped their hands instead of saying ‘one’. So the chant became ‘clap’, ‘two’, ‘three’, ‘clap’ and so on. Then the word ‘two’ was replaced with a foot stamp on the floor. Lastly, ‘three’ was replaced by snapping fingers. The exercise describes a simple algorithm, teaching students the importance of sequential ordering of words or movements in a playful way, while also training the students’ motor skills. The teachers were introduced to the exercise during a local programming workshop. During a second exercise, students cut out arrows and placed them in a certain order, describing how a figure should move over a grid. To reach a goal position, students had to break down the path into several steps, translate these steps into arrow-shaped symbols and place them in a vertical order. The first arrow indicated the figure’s first move, the second denoted the next move, and so on. The arrows decoded up, down, turn right, turn left movements. The third exercise was analogous, but students used the LightBot 2 app instead of physical arrows and grids. The teacher’s role during the lesson was to introduce the exercises in the beginning and to keep order during class. Students solved the exercises on their own and presented their solutions for the teacher before being allowed to continue with the next exercise.
In sixth grade, the students were asked to create a maths problem as a fairy tale for their classmates using ScratchJr. 3 The task was exploratory, and the students were divided into pairs with their bench companion. The teacher started the lesson by exploring what a mathematical problem is, before asking the students to download the ScratchJr app, and providing a short introduction to the app. Several groups started looking for a suitable problem in the maths book. The student interviews showed that some students tried to find a well-known problem and make only minor changes. One student group copied an example from the book without any changes. Others tried to adapt the problem to a new context. For example, one group created a combinatorial problem, asking how different garments could be combined into an outfit, since they were interested in fashion. All groups chose a problem that they understood well. Thus, there was no new mathematical learning. The challenge was to create the fairy tale in ScratchJr. Many students struggled with both practical issues, such as downloading and using the software, as well as programming issues. The teacher had to help them to solve these issues. At the end of the lesson, the teacher gave students the chance to present their progress for the whole class, if they liked. She asked questions that helped students to reflect on their programming experience. None of the groups managed to complete the task.
In ninth grade, we observed three successive programming lessons in mathematics. In total, three exercises were presented at the beginning of the first lesson, including a few hints and preferred outcome. Students worked with the exercises in groups of three or four during the first and second lesson. In the third lesson, the teacher presented a sample solution. The first exercise required students to create a spreadsheet that calculates the volume for several geometric figures based on provided values, for example, the height and radius of a cylinder. The second exercise was a modification of the first, in which the students were asked to reverse their formula and calculate, for example, the height of a cylinder, given volume and radius. The third exercise asked the students to solve the same mathematical problem using Python instead of spreadsheets. The students had worked with geometric figures and volume in a previous lesson and the teaching goal was to apply their mathematical knowledge using programming. However, several students did not recall the formulas used to calculate the volume. They had two strategies to overcome that problem: some students used the internet to search for the formula and discussed findings in their groups; some asked other groups, who in turn just gave the correct formula for the spreadsheet, thereby solving the task for the group. Other students kept busy formatting the spreadsheet when unsure what to do next to solve the exercise. Only a few individual students managed to solve the third exercise using Python.
How do teachers describe their teaching of programming in relation to the mathematics curriculum?
The teachers relate programming to the curriculum in two distinct aspects: mathematical skills and the mathematical area ‘geometry’, with the first aspect mentioned most often. The ninth-grade teacher describes the relation between programming and the mathematical skills thus: There is no change in proficiency measuring, so programming is not a mathematical skill of its own. Therefore, you can read programming as being part of problem-solving and maybe also communication, possible reasoning. Then if students learn some programming or so, it could even fit in the method and concepts skill, if you want so. But it's not … It's the same skills as before, so there's nothing new.
Regarding the central content, the interviewed teachers describe how programming can be used for understanding the mathematical area ‘geometry’ – for example, step-by-step instructions to make a robot move in a geometric figure, or programming to calculate volumes of geometric figures. No other mathematical area is mentioned, even though programming is positioned in the mathematical area of ‘algebra’ in the curriculum. We noticed that teachers described the relation between programming and mathematics as more obvious in higher grades (e.g. programming for ninth grade should be used to solve mathematical problems explicitly), but that lower-grade teachers followed the curriculum more closely (e.g. step-by-step instructions), and that the curriculum for the higher grades is more open and complex. For ninth grade, students should not only conceptualize programming as instructions and algorithms, but also be able to use different types of programming environments and languages. Finally, the teachers question why programming has become part of mathematics. They comment that programming would be more appropriate in technology classes, where students have already worked with robots, or even as a stand-alone subject.
How do students describe the relationship between programming and mathematics?
Second-grade students do not connect programming with mathematics. They describe programming as ‘map programming’, since they worked with a physical grid finding a way between two places. They associate programming with the tools they used, such as the LightBot app.
Sixth-grade students mention that they have been told that programming is part of the mathematics subject, but they are unsure why. They guess that it ‘has to do with ones and zeros’, or that ‘you should use an app so you can figure out how many steps it [a figure] needs to take. Yes, count …’ They connect the concept of programming with the programming tasks they performed. Some students describe programming as ‘creating games’ (e.g. in ScratchJr); others describe it as ‘controlling a machine’ (e.g. LightBot).
The interviewed students in ninth grade describe the need for mathematical skills as a prerequisite for being able to program. Through programming, they are motivated to apply their mathematical skills in a way that is important to them. So, the relation of mathematics to programming is: mathematics is a basic skill applied in programming. One student explicitly explains that you can start programming once you have learned mathematics properly. Mathematics is described as serious and important, programming on the other hand as a fun application. The definition of programming is connected to the programming language. One student describes Python as real programming, unlike block programming. Thus, programming is not seen as a process or cognitive activity (e.g. computational thinking), but instead as writing actual programming code. Only one student describes programming as a way to express himself in a creative and innovative way, but does not clarify what that means.
Discussion
We will explore our research question – how do teachers introduce programming in mathematics education in a Swedish primary school? – from two perspectives. First, we discuss what programming teaching knowledge teachers acquired and how it is used in the classroom. Second, we examine both teachers’ and students’ understanding of programming as part of the mathematics subject. Finally, we suggest two considerations when introducing programming into the mathematics curriculum.
Programming knowledge for teaching
The main approaches for acquiring programming knowledge were: a local workshop, internet resources, Hour of Code initiative, previous teaching experience, new school books and the local mathematics teacher network. These findings are in line with the work by Bocconi et al. (2018) that lists online networks as playing a key role in disseminating good practice among teachers, as well as the commitment of schools and municipalities to create conditions for all mathematics teachers’ participation in training initiatives. However, none of the interviewed teachers mentioned the web course provided by the National Agency for Education. We argue that this is problematic, since it is the main resource used by the National Agency for Education to communicate their vision of programming as part of the mathematics curriculum. We need to ask why the course is not used by teachers and how it could be adopted to better fit their needs (e.g. as a resource for collegial learning in schools).
In the following, we discuss what knowledge teachers acquired using Loewenberg Ball et al.’s teaching knowledge model (Loewenberg Ball et al., 2008). We interpret subject matter knowledge for programming as the ability to solve mathematical problems using computational thinking and programming (common content knowledge), and the knowledge of different programming strategies, including their differences and similarities (specialized content knowledge). Furthermore, we define pedagogical content knowledge as the understanding of students’ common programming errors, their conception of computational thinking and their motivation and interest in programming (knowledge of content and students); the competence to teach programming (knowledge of content and teaching); as well as knowledge of the mathematics curriculum that relates to programming. The above-mentioned resources provide teachers with ready-made examples for teaching programming by implementing the mathematics curriculum. They can be interpreted as examples of common content knowledge, knowledge of content and teaching as well as knowledge of curriculum. However, we argue that teachers do not acquire specialized content knowledge or knowledge of content and students using these resources. To acquire specialized content knowledge, more programming experiences are needed. According to Education (CECE) (2017), identifying and addressing students’ misconceptions is a key part of programming knowledge for teaching. However, relevant research on this topic is not as fully developed in the computer science education field as it is in mathematics and science education.
Programming as part of the mathematics curriculum
All teachers in our case study were familiar with the changes in the mathematics curriculum regarding programming. They implemented the new central content in their teaching at least once during the autumn semester. They expressed three major concerns regarding the new mathematics curriculum:
Mathematical skills and proficiency measures are not updated in the new curriculum. We question how much programming is needed in mathematics education, how programming knowledge should be tested and if programming will be part of the national tests (Nationella prov). There is little information why programming is included in the mathematical area ‘algebra’. We ask if an elaboration would help teachers to communicate the relation between programming and mathematics to the students more clearly. The central content regarding programming for ninth grade is ambiguous. Does ‘Programming in different programming environments’ means both block-based programming and textual programming. What is its purpose – learning different programming syntax or being able to generalize and conceptualize computational thinking?
Teachers argue that programming can be used to practise mathematical skills, especially problem solving. However, research is not conclusive in this matter. Psycharis and Kallia (2017) have found no significant improvement in students’ problem-solving skills through programming. Furthermore, in our case study, teachers used programming mostly to consolidate geometry knowledge. Similarly, Forsström and Kaufmann (2019) found that most of the research on connecting programming to mathematics focused on geometry. They call for more research that connects programming with other fields in mathematics. We suggest exploring in more depth how to connect programming to algebra, since it is found under algebra in the Swedish mathematics curriculum.
Lower-grade students do not see a relation between programming and mathematics. Ninth-grade students argue that mathematics is a prerequisite for programming. They describe mathematics as serious and programming as fun and motivational. Analogous, Kalelioglu and Gülbahar (2014) found that fifth-class students liked programming, but did not think that it improved their problem-solving skills.
Implications for introduce programming into the mathematics curriculum
We make two major suggestions to support the introduction of programming in the mathematics curriculum. First, the new curriculum should be supported by a solid infrastructure. Teachers need more resources to teach programming in mathematics professionally. A one-day workshop or web course does not afford sufficient programming teaching knowledge, as argued using Loewenberg Ball et al.’s (2008) model. More initiatives need to be implemented to support teachers in their daily practice. One opening is to investigate what resources the National Agency for Education could provide to support collegial learning in schools. Second, the relation between programming and mathematics must be sufficient motivated. Teachers and students need to understand why and how programming is part of mathematics education and how it can be put into a mathematical context. Is mathematical knowledge needed to be able to program, as stated by the students? Or can programming be used to train problem-solving skills, as argued by the teachers? How can programming support the different mathematical areas defined as central content in the curriculum? And finally, how much programming is required or even desirable?
Conclusion
In this study, we have explored how programming is taught as part of the mathematics curriculum in a primary school in Sweden. The National Agency for Education in Sweden has introduced programming as a mandatory part of the mathematics curriculum since 2018. To understand how teachers introduce programming as a mathematics subject in practice, we conducted an exploratory case study following three primary school classes (second, sixth and ninth grade) during the autumn semester 2018. The findings show that teachers were familiar with the new curriculum and that they implemented the new central content at least once during the autumn semester. However, they expressed a number of challenges regarding the curriculum, as well as a lack of sufficient programming teaching knowledge. Lastly, we suggest two considerations when introducing programming into mathematics curriculum: the need for a solid infrastructure scaffolding the curriculum changes and supporting teachers’ programming knowledge acquirement, as well as an appropriate elaboration of the relation between programming and mathematics to put programming into a mathematical context.
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.
