1 Introduction

Modern society is developing dynamically from a technological and a cultural, economic and social standpoint. Over the past few decades, Science, Technology, Engineering and Mathematics (STEM) education has gained international attention due to the shifting nature of the global economy and the predicted lack of STEM-trained people globally (Kennedy & Odell, 2014). State legislatures in the United States demand that K–12 STEM education be reformatted to develop the next generation of qualified scientists, engineers, technicians, and teachers of science and mathematics (Business-Higher Education Forum (BHEF), 2007; National Academy of Sciences (NAS), 2007). In Europe, the European Coordinating Body in STEM Education released a publication defining STEM education challenges in Europe and focusing on widening the STEM skills gaps in European countries (Joyce & Dzoga, 2011). South Africa is not left out as the Department of Basic Education revised the National Curriculum for students in Grades R through 9 to include Coding and Robotics Draft CAPS (2022). This development demands curriculum innovation, teachers’ access to newly introduced topics or subjects and their implementation in teaching (Buckova & Dostal, 2019), as such young students are encouraged to advance their knowledge in the area of STEM education because of its continued application in both professional and day-to-day life.

According to the South African Department of Basic Education (DBE, 2022), Coding and Robotics are critical for students’ development to function in a digital and information-driven world, apply digital ICT skills and transfer these skills to solve everyday problems. Coding and robotics as a subject involve activities that deal with problem-solving through logical and computational thinking. These skills are expected to equip and expose students to digital literacy, virtual reality, augmented reality, machine learning, artificial intelligence, and the Internet of Things (DBE, 2022). Several scholars have proposed using educational coding and robotics as a didactic methodology for an integrated approach to STEM teaching (García-Carrillo et al., 2021; Stewart et al., 2021). According to Stewart et al. (2021), coding can take many forms, from simple instruction input via a numeric keypad on a robot’s chassis to more complex graphical user interfaces with interconnected blocks serving as a metaphor for visual programming. Students with more advanced skills can learn to code in complex text-based languages. Coding exercises also allow students to practice a range of abilities, including reading and writing, providing an edge in global culture and the ability to reinforce classroom curriculum standards and education. (Mensing et al., 2013; Moreno-León et al., 2015). However, the main goal of coding in schools typically focuses on developing students’ problem-solving abilities to prepare them for college and professional careers.

The desire to equip young South African students with the skills and knowledge necessary to meaningfully participate in society as scientific citizens seem to have taken a long time for STEM to be included in the educational curriculum at all levels, particularly early childhood. However, the traditional approaches to teaching and learning STEM education are not efficient enough in fulfilling this goal. In light of this, the education community is advocating for developing new strategies capable of teaching students STEM subjects for young people. This training will allow them to make informed decisions about their career options (García-Carrillo et al., 2021) because providing children with a solid foundation in STEM subjects can help prepare them for their future careers (National Science Board, 2018). For instance, learning to code in the K-12 educational contexts allows students to create, communicate, and solve problems using technology that is considered essential for a global competitive workforce (Breiner et al., 2012; Durak & Guyer, 2019; Kalelioglu & Gülbahar, 2014). Contrarily, Resnick (2013, p. 16) argues that coding should be viewed as not just a “pathway to good jobs, but as a new form of expression and a new context for learning”. There is considerable discussion about STEM education and how it might be incorporated into young students’ academic development and future job choice. However, understanding students’ attitudes regarding coding and how it relates to their interest in STEM jobs is more crucial.

This study aimed at exploring young students at South African township schools from Grades 4 to 7 attitudes towards coding and its relationship with their STEM career interests. The essence of this exploration is to identify students’ perceptions towards coding and factors that influence their STEM career choice. The research questions used to achieve this aim are – 1) What are the attitudes and opinions of school students regarding coding education? 2) What is the interest of school students towards STEM careers? 3) How are students’ attitudes towards coding correlated to their interest in STEM careers? The study’s findings and suggestions will influence policy and advance knowledge and practices in STEM education.

2 Literature review

Science, Technology, Engineering, and Mathematics (STEM), and coding are closely related fields that can lay the groundwork for various occupations in the twenty-first century. Integrating coding activities into learning environments gives students the chance to practice a variety of skills, including the development of reading and writing skills, giving them an advantage in a growing, global society and the ability to reinforce classroom content standards and instruction. (Mensing et al., 2013; Moreno-León et al., 2015). STEM education emphasizes children’s cognitive growth (computational thinking, creativity, thinking processes, and metacognitive awareness) and the skills they will need in the twenty-first century (Papadakis et al., 2022). Some researchers also contend that learning to code as a young child should not only focus on developing technical abilities but also a new form of literacy and self-expression that students will need to succeed in the twenty-first century (Pugnali et al., 2017; Resnick, 2017). Bers (2020) also accentuated that coding can be viewed as a method that enables users to build shareable goods and a mechanism for solving problems across disciplines. Despite the connection of STEM subjects and coding in creating a soft landing for the twenty-first-century workforce, curriculum innovation and teachers’ access to newly introduced topics or subjects and their implementation in teaching are required (Buckova & Dostal, 2019). As such, there is a need for curriculum reformation, reskilling of teachers and availability of teaching resources that would enable the benefits of coding and STEM subjects for the future workforce, especially in developing countries like South Africa.

In South Africa, the educational content for Information and Communication Technologies is innovated based on revisions made by the Department of Basic Education. Coding and Robotics have been added to the national curriculum for students in grades R through 9 (DBE, 2022). However, research indicated that the current curriculum might include elements of computational thinking but does not provide adequate opportunity for primary and lower secondary school students to learn about digital computer science at the scale needed (Fares et al., 2021). Bezuidenhout (2021) added that the curriculum plan still needs to include a conceptual framework that guides the creation of instructional resources to assist in teaching STEM literacy. Geldenhuys and Fataar (2021) also discovered that the main barrier to teaching coding effectively turned out to be a lack of understanding of computational thinking abilities and consideration of the prerequisite abilities that students would need to be able to participate in coding effectively. Hence, Geldenhuys and Fataar (2021) suggested that the following issues must be resolved for the implementation of coding to be successful: “professional development addressing teaching methodologies on the development of computational thinking skills in young learners, providing support for teachers, addressing time constraints in the teaching of the subject, and providing resources.” It is important to have studies that have dealt with the promises and challenges of teaching young children coding and STEM subjects in South African schools. What seems to be lacking in the literature is research on young students’ attitudes regarding coding and their interest in STEM careers which is the focus of this present study.

Attitudes have been central to educational research for several years. Several authors agree that a critical goal of science education is to encourage positive attitudes (Mao et al., 2021). Osborne et al. (2003) gave a list of components of attitude towards science. These components are:

“perception of the science teacher, anxiety towards science, the value of science, self-esteem at science, motivation towards science, enjoyment of science, attitudes of peers and friends towards science, the nature of classroom environment, achievement in science and fear of failure on course.” (Osborne et al., 2003., p. 1054)

Students’ attitudes toward coding can vary greatly based on several variables, including age, experience, and technology exposure. For instance, Kalelioğlu (2015) and Theodoropoulos et al. (2016) indicate that students in elementary school between the ages of 10 and 12 develop a positive attitude towards coding/programming after using code.org. Relating technology experience and attitude, Hsiao et al. (2022) argued that students who have experience with coding are typically more enthusiastic about it than those who do not have. According to Marginson et al. (2013), girls and women are underrepresented in STEM professions at all levels of school and employment. In addition, Svenningsson et al. (2021) echo that researchers have frequently utilized students’ attitudes to assess their knowledge and willingness to pursue a career by studying a subject area in school, such as technology.

With the fast movement of technology and the high demand for a STEM-related workforce, the challenge is worldwide that there is a critical shortage of STEM workers (Vela et al., 2020; Yahaya et al., 2022). The shortage of the STEM workforce, according to researchers, could be a result of several children with outstanding mathematics or science achievements still opting not to pursue STEM jobs, despite several measures to promote STEM career interest practically implemented in various STEM education programs (Carnevale et al., 2011; Karahan et al., 2021).

Increasing students’ interest in STEM vocations is one of the main objectives of STEM education. (Luo et al., 2021). To encourage students’ favorable attitudes toward their study of coding and their choice of STEM-related professions and occupations, Marginson et al. (2013) contend that strategies should be developed considering the student’s context, gender, and cultural background. Furthermore, Marginson et al. (2013) echo that to develop and articulate STEM-specific policies and programs, a national STEM policy should offer a clear framework, and teachers’ professional development should address problem-solving, critical thinking, inquiry-based approaches and teaching methods that would increase student engagement in science and mathematics. Hence, it is critical to comprehend students’ attitudes regarding coding and their enthusiasm for STEM occupations because doing so can inform educators and policymakers about the best ways to encourage young pupils at an early stage.

3 Theoretical framework

This study is underpinned by social cognitive career theory (Lent et al., 1994), which is formed based on social cognitive theory (Bandura, 1986). Social cognitive theory (SCT) theorizes that people learn in a social context with a dynamic interaction from their own experiences and by observing the experiences of others (Bandura, 1986). As a result, a person’s behavior becomes influenced by the interaction of that person with personal factors (age, cognitions, experience with the behavior), environmental factors (access to resources, safety, support from family/friends), and aspects of the behavior itself such as the vigor of the behavior, outcomes achieved as a result of practicing the behavior, and competence with the behavior (Bezner & Held Bradford, 2019). Such behavioural changes are crucial to increasing trust, self-confidence, and ability (Brown and Brooks, 1996).

Social Career Cognitive Theory (SCCT), based on Bandura’s social cognitive theory, explains how a person’s educational choices and job interests are moderated by their cognitive and individual-related beliefs. These beliefs include self-efficacy, outcome expectations, and social supports, which moderate career goals and intentions (Lent et al., 2008). This theory implies that career activities and career interests are highly correlated. The theory shows a feedback loop in which self-efficacy and outcome expectations are derived from performance attainment. Self-efficacy is defined as people’s assessments of their abilities to organize and carry out tasks needed to achieve a specific type of performance (“I know I can do it”). At the same time, outcome expectation is one’s belief about the repercussions of taking specific actions or behaviors (“What will happen if I do it?”) (Bandura, 1986, p. 391). Conversely, goals are defined as one’s determination or commitment to engage in a particular behavior or activity. Based on these explanations, it is assumed that students’ ratings of their self-perceptions and attitude towards coding could influence their interest in pursuing STEM-related careers. Modifying students’ attitudes and perceptions regarding self-efficacy, social support, personal goals, and outcome expectations can help them acquire new successful experiences and open their eyes to STEM career occupations. So, the application of SCCT in this study is to understand how students’ coding attitudes and values, linked to their self-efficacy and outcome expectations, affect their choice of STEM occupations.

4 Method

A concurrent mixed-method research approach (Creswell & Plano Clark, 2011) was used to examine students’ attitudes towards coding and its relationship with their career interest in STEM. The participants consisted of 50 students, 21 of whom were boys (42%) and 29 of whom were girls (58%). The students came from public primary and secondary schools in a densely populated Township in Gauteng, South Africa. Students were selected by their teachers to take part in the after-school programme based on their interest in Coding and Robotics. The participants comprised twenty-six Grade 7 students, who constituted 52% of the respondents, two Grade 8 students (4.0%), eight Grade 9 students (16%), ten Grade 10 students (20%) and four Grade 11 students (8%). Participants were between the ages of 10 and 15.

The questionnaire adopted for this study was the Elementary Student Coding Attitudes Survey (ESCAS) developed by Mason and Rich (2020) and the STEM Career Interest Survey (STEM-CIS) developed by Kier et al. (2014). The ESCAS instrument consisted of 23 questions in five dimensions (coding confidence, coding interest, coding utility, social value and perceptions of coders), while the STEM-CIS consists of 19 questions in four subject areas. The instrument was first piloted with five students and two teachers not in the selected sample. In the pilot study, students and instructors had to highlight and comment on any unclarity. No legibility issues were raised, and the original questionnaire was adopted. The questionnaire was then administered to students after the intervention program. Participants were required to choose options from a six-point Likert scale. This was coded as 1 = Strongly Agree, 2 = Agree, 3 = Somewhat Agree, 4 = Somewhat Disagree, 5 = Disagree, and 6 = Strongly Disagree. The Cronbach’s alpha for the five dimensions of the ESCAS scale used in this study ranged from 0.60 to 0.87 across all the constructs represented in the survey. Kier et al. (2014) conducted the confirmatory factor analyses with each subscale of CIS (i.e., Science, Technology, Engineering, and Mathematics), finding the normed fit index (NFI) > 0.80, the comparative fit index (CFI) > 0.90, and the root mean square error (RMSEA) < 0.04. Hence, the content validity and construct validity were also satisfactory. In this current research, the average scores for each discipline of the STEM-CIS were determined. Cronbach’s alphas for science, technology, engineering, and mathematics were 0.64, 0.72, 0.79, and 0.81, respectively. Similarly, for the ESCAS questionnaire, average scores were calculated for each dimension, with higher scores indicating higher levels of positive attitude. Mean (average) calculations determined general trends corresponding with each scale and item. Standard deviations were also obtained to quantify the amount of consistency among respondents for each scale. The interpretation of the numerical scale follows the methodological guidelines of the Likert scale (Warmbrod, 2014), which means that scores below the overall average indicate an unfavourable response, while scores above the overall average are considered a favorable response. Correlation analysis was applied to identify the power and direction of the association among the scaled variables. The relationship between coding attitudes and STEM career interests was assessed using multiple linear regression analysis, with each career interest as the dependent variable.

Qualitative data was collected through students’ participation in focus group interviews. Through these interviews, the researchers solicited in-depth explanations of students’ attitudes towards coding. The focus group interview was initiated through questions such as “what do you think about coding education?”, “which of the courses do you think that coding and robotics education contribute?” and “what are the contributions of coding and robotics education to your courses/career?”.

4.1 Procedure

The research was conducted during an after-school programme in a specific Township School. The after-school programme focuses on exposing primary and secondary school students within the community to new technological skills and deepening their engagement in academic activities. One of the after-school programs conducted in the selected community is the coding workshop, which exposed students to coding without using a computer. Individual students from three schools within the community interested in the coding workshop gathered in a classroom at a specific school. The after-school workshop was conducted in October 2022 by the TANGIBLE Africa training group. The workshop focused on using the TANKS mobile game as a coding app to introduce young students to coding concepts without using computers. TANKS is a tangible programming platform game that introduces South African students between Grades 3 and 9 to basic coding, programming, and computational thinking concepts by using a game that uses tangible tokens, image recognition and a mobile phone app that can work offline. Hence, the game does not require the use of a computer. Tanks have 35 levels, requiring students to get the tank to the destination at each level. As a result, students were asked to work as a team and, with the help of group members, move through the different levels of the game and get to see first-hand how a computer takes a set of instructions – interprets them as a language and then processes that language for an outcome. TANKS can only be moved when the player uses the physical puzzle pieces given to build the code. Once the code had been pieced together, students used the smartphone’s camera to scan the tokens, upload the image and move the TANK, as shown in Fig. 1.

Fig. 1
figure 1

Picture of students during the TANK activity

When students reached the last level, they would have been exposed to computational thinking concepts such as “for loop”, “while loop”, “if statement”, optimization, and algorithm. The TANKS app was created in 2017 by Byron Batteson, and the TANKS project has since evolved into a larger unplugged coding project in South Africa, coordinated by Professor Jean Greyling. TANKS allow facilitators to go into schools without computers with just some puzzles and one cellphone. Hence, children can be introduced to coding and informed about computer science as a career (Mano, 2019). At the end of the coding game, students were required to fill in a questionnaire. Permission to collect data in the school and consent was obtained from the school principals, teachers, students, and workshop facilitators.

5 Findings

5.1 Response to students’ attitudes and opinions regarding coding education

Table 1 shows that the overall mean score across the 50 students’ attitude survey items was 1.85 with a standard deviation of 2.99, a positive rating indicating agreement with statements about the attitude towards coding.

Table 1 Descriptive statistical analyses of students’ coding perceptions

Thus, scores below 1.85 indicate an unfavourable attitude, and scores above 1.85 are considered favorable toward coding. Analysis of participants’ responses reveals that students’ perceptions of coders had an average scale score of 2.40 and a standard deviation of 1.087. Response to the social value of coding had an average scale score of 2.35 and a standard deviation of 0.768, higher than 1.85. However, the average response of participants to coding confidence was calculated as (M = 1.81, SD = 0.578), coding interest (M = 1.35, SD = 0.412), and coding utility (M = 1.49, SD = 0.413), which is lower than the overall attitude score. These responses suggest that students’ attitudes toward coding were influenced mainly by their perceptions of coders and the coding profession and their parents and friends’ appreciation of coding. Based on the overall attitude scale, the three highest-rated statements of the survey on students’ opinions about coding were “kids who code enjoy doing sports” (M = 2.98, SD = 1.39); “I am friends with kids who code” (M = 2.50, SD = 1.56); and “Kids who code are smarter than average” (M = 2.48, SD = 1.40). While the lowest-rated statement was “I would like to learn more about coding” (M = 1.12, SD = 0.32). Students’ opinions of coding were further explored during the focus group session, where some of the students spoke about the value/benefits of coding. These responses are revealed in the following excerpts:

Coding is very beneficial, and there is a shortage of people who use it in their careers, so it gives one an advantage over others, and I also think coding is fun.

Coding creates many career opportunities and teaches you many languages like HTML (Hyper Text Markup Language) and CSS.

Coding can help me develop some business minds in the 4IR and enhance my evaluating skills because I was rushing over everything when we were playing the tanks game. However, the facilitator encouraged us to take a chill, look at our tokens thoroughly, analyse them, and then start connecting them. Moreover, that helped me calculate every step I wanted to take before connecting the tokens.

One thing I picked from the coding activity we did was teamwork. When we first started, I did not understand what we were doing, so I thought of giving up. However, members in my group kept trying (persevered) until we could add things together and link the tokens properly.

Using coding to teach Mathematics, Natural Sciences and Technology will make it easier for us to learn and understand the icing concepts, i.e. it will help us understand what we are doing because these subjects are very hard to understand if you do not know the basics. I see from what we did that we started with simple codes before getting to the tougher ones, so they did not look hard, and I believe if such an approach is introduced into how we are taught these hard subjects I mentioned, it will be easy to get the basics and understand them.

5.2 Response to students’ career interest in STEM

Table 2 shows that the overall average and standard deviation of sampled school students’ interest in a science, technology, engineering and mathematics career is 2.00.

Table 2 Descriptive statistical analyses of students’ STEM career interest

Analysis of the STEM-CIS scale based on the four subscales reveals that the science field average was 1.97. The standard deviation was calculated as 0.714, considering the technology field (M = 1.97, SD = 0.716), the engineering field (M = 2.34, SD = 0.935) and mathematics field (M = 1.80, SD = 0.738). It is observed that S4, T1, T4, T6, E1, E2, 3E3, E4 and M5 are above average. Students look to professionals working in science, technology and mathematics-related professions as role models. Students indicated they could do well in technology-related activities, and their parents would like it if they chose a technology-related career. Out of the four subject areas in the STEM-CIS scale, it is interesting that most students are interested in engineering-related careers. This interest is evident in their response, as the majority indicated that they could work hard and do well in engineering-related activities, learn a lot about engineering and plan to use engineering in their future career. However, the items/questions coded as “S1, S2, S3, T2, T3, T5, M1, M2, M3 and M4” were lower than the overall average of the STEM-CIS scale. As a result, students provided some negative responses to these items. Analysis of participants’ responses to the survey items implies that students have no plans to pursue any science, technology, and/or mathematics-related work in their future career plans. Students do not believe that excelling in science, technology and mathematics activities will enable them to pursue these careers. However, findings from the qualitative data indicate that some students are interested in STEM-related occupations and view coding abilities as relevant to their future careers.

Coding and robotics contribute to physical sciences, mathematics, and all other science-related subjects. This will provide a foundation to better understand concepts used in my career as I plan to work in nuclear engineering.

I want to be a medical doctor, and after hearing the explanation and participating in the activities, coding will help me think critically before making decisions.

Coding will help my career as a future engineer by increasing my knowledge, ability to solve problems, and ability to invent and create machinery that can solve problems.

5.3 Correlation between students’ attitudes towards coding and career interest in STEM.

To examine students’ attitudes about coding and its relation to their STEM career interests, we used Pearson’s correlation coefficients (see Table 3). Findings from Table 4 show that strong correlations existed between the Attitude variables coding confidence and coding interest (r = 0.535, p < 0.001). In contrast, a moderate negative correlation (r = -0.498, p < 0.001) existed between coding confidence and the perception of coders. This response implies that students confident of their ability to code tend to have less positive perceptions of coders. A significant association also existed between coding interest and coding utility (r = 0.447, p = 0.001), suggesting that a generally positive attitude towards learning can be observed across several characteristics within an individual. Moderate correlations existed between social values (r = 0.435, p = 0.002) and students’ perceptions of coders. Analysis of the STEM-CIS also showed the four latent subscale scores to be correlated except for mathematics and engineering. Correlations between subscales ranged from r = 0.42 to 0.59. Examining the associations between attitude variables and career interest showed that a weak correlation existed between coding interest and interest in science career (r = 0.283, p = 0.047) as well as coding utility and interest in science career (r = 0.293, p = 0.039). A statistically significant (p < 0.001) strong positive correlation also existed between students’ perceptions of the social value of coding and their career interest in technology (r = 0.514), as well as coding interest and career interest in engineering (r = 0.506). At the same time, a moderate correlation existed between coding confidence (r = 0.359, p = 0.010) and career interest in engineering and coding utility (r = 0.425, p = 0.002). Students’ career interest in mathematics moderately correlates with their perception of coders (r = 0.425; p = 0.002).

Table 3 Pearson Product Moment Correlations – Scaled Variables for Coding Attitudes and Career Interests
Table 4 Standardized Regression Coefficients of coding attitudes controlling for Gender on CIS

A series of regression analyses examined the associations between ECSA and STEM-CIS variables. The regression model used the ECSA domains as independent factors, whereas each CIS variable was treated as a dependent variable. Regression results for each of the four CIS areas are shown in Table 4.

The direct association of student attitude towards coding to their interest in STEM-relation careers is identified through coefficient determination (R2) from the model in Table 4. According to Kline (2011), R2 is important in determining how well the exogenous research variables can explain the influence of the endogenous variable. Table 4 shows that the attitude variable explained only 29.1% (R2 = 0.291, p = 0.008) of the variance in students’ interest in a science career, 34.9% (R2 = 0.349, p = 0.002) of the variance in students’ interest in a technology career, 32.5% (R2 = 0.325, p = 0.003) of the variance in students’ interest in an engineering career, and 40.1% (R2 = 0.401, p < 0.001) of the variance in students’ interest in mathematics career, which is all statistically significant. The findings revealed that each ESCA domain was associated with a distinct career interest. Among the five attitude variables, only four were statistically significant predictors of students’ interest in STEM-related careers: coding confidence, coding interest, social value and perceptions of coders. Coding utility was not a significant factor for all four dependent variables. The result of the regression analysis shows that coding confidence (β = 0.33, t = 2.20, p = 0.03), coding interest (β = 0.33, t = 2.27, p = 0.02) and perceptions of coders  = 0.60, t = 4.17, p < 0.001) were significant contributors in explaining students’ interest in a mathematics career. As found in the analysis, the perception of coders was a significant contributor to students’ interest in science but not technology and engineering. Students’ interest in coding was also found to be a significant predictor of their interest in engineering careers, while students’ opinion on the social value of coding was linked to their interest in technology-related careers.

6 Discussion

This study aimed to determine school students’ attitudes towards coding and its relation to their STEM career interests. The attitudes of students towards coding were evaluated from five dimensions: students’ coding confidence, coding interest, coding utility, social value and perception of coders through socio-cognitive theory. Findings for the first research question indicate that students have an overall positive attitude toward coding. Most respondents indicated that coding was important and had broad implications and applications. However, their attitudes toward coding were found to be primarily influenced by their perceptions of coders and the social value of coding. For instance, most students agreed that children who code enjoy sports, tend to be smarter than average and also asserted that their parents and friends value coding. At the same time, some of the respondents indicated that coding is enjoyable and can lead to various job opportunities. When adults (parents, teachers, and other family and adult leaders) encourage students to take up science and mathematics in middle and/or high school, the likelihood that a young adult will pursue and remain in STEM jobs increases (Mason & Rich, 2020; Wang et al., 2016). As a result, parents, schools and friends are important factors influencing young children’s attitudes toward coding (Mason & Rich, 2020). In addition, students’ attitudes towards coding and STEM may also be influenced by their socioeconomic background (Scherer & Siddiq, 2019). Students may develop positive or negative attitudes towards science and coding based on their parent’s financial status, level of education, occupation, ambition, and availability of resources at home (Betancur et al., 2018). Scherer & Siddiq, 2019). As a result, attitudes toward science and coding can be linked to socioeconomic level. On the other hand, it was discovered that participants’ responses to coding interest, coding utility, and coding confidence were low, indicating that some of the students have a negative attitude towards coding. According to Jiang et al. (2023), students with higher self-efficacy are more confident in overcoming obstacles when coding/programming and are more likely to work on it until it is completed. However, students’ low self-efficacy in problem-solving is believed to influence their attitudes toward coding negatively. In light of this, encouragement from family and peers can help increase the likelihood of students’ participation in computer science-related activities such as coding/programming, which may influence their coding interest, utility, confidence, and STEM identity.

In answering the second research question concerning students’ interest in STEM careers which was evaluated through Social Cognitive Career Theory, it was discovered that students’ contextual support and self-efficacy were above average in the dimensions of science, technology, engineering and mathematics. This finding suggests that students with greater self-efficacy and contextual support tend to have more interest in STEM-related careers. This finding supports the claims of Jiang et al. (2023) that students are more likely to choose STEM occupations when they are interested and confident in some important subjects or skills in STEM fields. The items in the STEM-CIS scale show a positive correlation between students’ self-efficacy, outcome expectation, personal goals and interest in STEM subjects and contextual support in STEM fields. However, the data show that students perform below the overall STEM-CIS average regarding personal goals, outcome expectations, and interest in STEM subjects, as measured by the Social Cognitive Career Theory. This finding suggests that the sampled students do not have personal goals or outcome expectations in STEM professions, which could be attributed to the fact that students have not yet made a career decision. Hence, opportunities for students to develop their career aspirations must be provided early (Dönmez & Idin, 2020). However, it was remarkable to find that most of the students were interested in the engineering field.

In answering the third research question concerning the relation between students’ coding attitude and their interest in STEM occupations, the overarching result shows a positive relationship between attitude towards coding and STEM career interest. The findings of this study also show a significant influence (p < 0.001) between coding attitudes and students’ interest in STEM careers, with a large effect of r = 0.615. This result provides a huge variance value for the effect of each coding attitude sub-construct towards the formation of students’ interest in STEM careers. The strong correlation between coding attitude and interest in STEM occupation is vital to using the social cognitive career theory with STEM needs (Lent et al., 1994). A closer look at the relationship between the different sub-constructs reveals that each attitude subconstruct was linked to a specific career interest. Coding confidence, coding interest and perceptions of coders were found to be statistically significant predictors of students’ interest in mathematics, while social value was a significant predictor of students’ interest in a technology career. Coding interest was also found to significantly predict student interest in an engineering career, while the perception of coders significantly predicted students’ interest in science careers. These findings are similar to those of Navarro et al. (2007), who found that making a career plan in the STEM fields depends on students’ awareness of talent and capacity. Even though coding is widely used as an essential skill in STEM occupations, students who lack confidence in their coding abilities may not pursue STEM careers (Jiang et al., 2023). It is well known that attitudes can sometimes influence the choice of occupations more than education or employment opportunities; therefore, it is important to help students cultivate positive attitudes towards STEM skills like coding/programming. The right attitudes will increase the likelihood of students’ enrolment in computer science programs at the university and interest in STEM-related careers.

7 Limitations

The findings of this study are interpreted with caution due to some limitations that are acknowledged. First, the small sample size and specific geographic area used in this study is a significant limitation. As a result, findings from this study cannot be generalized to students across the country. Future studies could involve conducting larger-scale investigations to enhance the applicability of the findings. The studies can also investigate rural and urban students’ coding attitudes and how it relates to their interest in STEM careers. They can also examine potential differences with township students if they can engage in some coding workshop or experience TANK coding. Future research also includes considering the influence of factors such as socioeconomic status on students' attitudes towards coding and their interest in STEM careers. Second, the research did not investigate the long-term effect of the intervention on students' attitudes and enthusiasm for pursuing STEM careers. Future studies could also involve exploring the durability of the impact of the intervention on students' attitudes and interest in STEM careers and evaluating the effectiveness of different coding apps and tools in enhancing these attitudes. Lastly, examining the role of teachers in promoting a positive attitude towards coding and STEM careers among students should also be considered.

8 Conclusion

The results reported from this study offer important insight regarding the importance of enhancing students’ attitude towards coding/programming. The results showed that there was a significant relationship between students’ attitude towards coding and interest in STEM career. Stimulating students’ interest and attitude towards coding can help them develop STEM skills. The use of TANK as a coding app in this study exposed students to tasks that allowed them to think critically and develop algorithm to solving problems. Thus, curriculum developers and teachers need to identify acceptable approaches to improving students' attitudes about coding. When students are motivated and competent in coding, it can affect their self-efficacy, outcome expectations, personal ambitions, and enthusiasm in STEM disciplines, as well as their contextual support in STEM domains.