
Computer programming has become a vital topic in formal educational scenes especially in the last decade after the introduction of the concept of computational thinking. Computational thinking, or problem-solving activities that make the most of computing, is an integral part of the twenty-first-century skills, which include critical thinking, creativity, flexibility, leadership and social collaborative skills. Beginning in 2009, the authors started a project to teach programming through the process of writing code to control model trains. Though we began with a textual programming environment, as we analysed teaching and learning practices in junior high schools, we developed a visual block programming environment for teaching programming, initially because students were not very familiar with the keyboard. The block programming environment, however, had unexpected effects of motivating students, of both genders, whose power seemed to have come from the students’ collaborative interactions while working on their programs. We conducted a series of surveys and tested which socio-emotional factors best contributed to learning programming in the classroom environment, as assessed by end-of-class project and exam scores. This research was part of an ongoing action research agenda to find and refine the best ways to motivate students aged 12–15 to learn programming and computational thinking skills, which became required for all Japanese students by Ministry of Education guidelines adopted in 2018.