A regular area for debate among teachers of programming is how best to support the transition from visual programming to text-based languages. Visual languages and environments are a hugely powerful tool for introducing students to the concepts of programming, allowing them to explore concepts, solve problems, and create products through programming. However, it’s important to get the experience of working in text-based languages, both to cover the curriculum and to develop the skills for the next stage. This article will explore common challenges when making the transition from blocks to text, and the tools you can use to support this.
Many learners have access to computers or mobile devices, or have some experience using them. Despite this, when learning to use a text-based language, there are still some major hurdles for students to overcome, many which have little to do with their ability to think logically or computationally.
Even students who have grown up with a games console, laptop, or tablet will often struggle in the early days when it comes to typing — they are often more used to typing with their thumbs on an on-screen keyboard. Young learners in particular can become very frustrated by this, as it can take several minutes to type out even the shortest of programs, and they spend a lot of their time learning the basic syntax rules, which leaves little time for them to experiment and be creative. You can use software to help correct errors in code, but these applications are often quite complicated and unsuitable for beginners. This means that learners have become accustomed to not recognising errors, such as a missing capital letter, until after they run their programs.
There can also be problems relating to a learner’s literacy. Even without learning difficulties such as dyslexia and dyscalculia, many young learners are unable to recognise the difference between:
<b>for i in range(5): </b>
<b>For I in ragne 5: </b>
when they first type the line. Even the best programmers will occasionally make mistakes, such as typing
Rethinking the transition
Researchers Dorling and White, however, suggest that we might want to think about this transition in a different way (helloworld.cc/dorling2015). They explored approaches including unplugged, visual, and textual programming, and the ways students engaged with problem-solving in these contexts. They discovered that it was valuable to think about these different media as pedagogical tools, with different strengths for teaching and learning, rather than as stages students leave behind as they progress.
In their research, they outlined a pathway that used unplugged, block-based, and text-based approaches to teach the fundamental control structures of programming (sequence, repetition, function, selection, and communication). The specific languages used were Logo, Python, and Scratch; all three share similarities of sequential processing with a sprite or turtle and the reward of the instant feedback of sprite or turtle activity on the screen.
The researchers chose a cross-curricular context (geometric shapes and patterns) to teach the background of each of the control structures. By using this approach, Dorling and White concluded that “there is established pedagogy in other subjects that can be effectively used in a computing lesson. In turn, it was also evident that programming could enhance the delivery of other curricula topics.”
Having a linear transition from blocks to text without any cross-curricular context may not be a suitable approach to take when learning programming. When introducing new concepts, such as local and global variables, learners may find using block-based programming languages easier to use and understand. It gives learners an opportunity to see the similarities between two languages and a clear context that they understand.
Tools to support
When learners are new to text-based programming, they may feel apprehensive about learning code. It is worth discussing how they are feeling and trying to mitigate any risk of them being put off text-based programming. Hybrid platforms such as the micro:bit MakeCode editor and EduBlocks are a great way of doing this. These online platforms have developed a block-to-text feature, which includes a tool to drag and drop blocks of code, similar to Scratch, although the blocks correspond more directly to Python code. These online platforms also give the ability to toggle between blocks and Python code, or to split the screen to view blocks and code next to each other.
These tools help to bridge the gap between block-based and text-based programming languages by:
Using a familiar drag-and-drop user interface
Allowing users to transition between block-based and text-based methods while creating a program
Helping learners become familiar with Python code in a way that reduces errors that could arise when typing code into the micro:bit editor
Some applications, for example Pencil Code, offer a dual-modality (or hybrid) environment, in which learners can write and see the same program in a text-based and a block-based programming environment side by side. The key point of dual-modality environments is that the code is displayed automatically in the alternative text-based format: block-based code is automatically translated to text-based code, and vice versa. In a 2017 study, researcher David Weintrop set out to test the assumption at the heart of dual-modality applications, that being able to match a text-based program to its block-based equivalent supports the development of understanding program syntax in a text-based language (helloworld.cc/weintrop2018).
Weintrop carried out a 15-week study with 14-to-16-year-old students in the US to investigate the differences in learning when using block-based, text-based, or hybrid (a mixture of both, using a dual-modality platform) programming tools. The 90 students in the study were divided into three groups. Each group was set the same tasks with the same learning objectives, but they used either block-based programming, text-based programming, or the hybrid environment. After five weeks, students were given a test to assess learning outcomes, and they were asked questions about their attitudes to programming, specifically their perception of computing and their cofidence with programming. After another ten weeks, all the students were taught Java, and then the test and attitudinal questions were taken again.
The results showed that at the five-week point, the students who had used block-based programming scored more highly in their learning outcome assessment than the text and hybrid groups, but at the final assessment after 15 weeks, the scores of all the groups were roughly equivalent. In terms of students’ perceptions of computing and their confidence levels, the responses of the block-based group were very positive at the five-week point, but less positive after 15 weeks. Taking both methods of assessment into account, the hybrid group showed the best results, and the use of block-based programming did not hamper students’ transition to text-based programming. Although more research is needed to support the conclusions of Weintrop’s study, the approach of the hybrid group can be adopted in many classrooms.
Block-based languages are valuable when introducing any new programming concept to learners, and the development of more and more hybrid models makes it easier for learners to identify the similarities between blocks and text. Perhaps there is no linear path from blocks to text; maybe the important thing is that teachers know and understand the tools that can be added to their toolbox in order for them to teach programming effectively to their own learners, in their own specific context.