Skip to content
MakerBuddy

Block Coding vs Text Coding: When Should Students Switch?

Block coding and text coding teach the same logic in different clothes. See what research says about switching, an age guide, five signs a student is ready, and one sensor project built three ways.

By the MakerBuddy teamPublished 19 min read

A laptop on a classroom table shows the same visitor counter twice, as snapped blocks reading when motion starts, change x by 1 and show x on screen, and as text lines with x = x + 1 highlighted, while a cable runs to a board wired to a motion sensor and a blue screen reading Visitors: 2.
A laptop on a classroom table shows the same visitor counter twice, as snapped blocks reading when motion starts, change x by 1 and show x on screen, and as text lines with x = x + 1 highlighted, while a cable runs to a board wired to a motion sensor and a blue screen reading Visitors: 2.

Block coding means building a program by snapping visual blocks together instead of typing it. Text coding means typing the program in a language such as Python or C++. Both teach the same logic: order, decisions, loops and AND/OR tests. So when should students switch? Not on a set birthday. Switch when a project needs something blocks cannot do, usually a variable that counts or remembers, and when the student can predict what a block program will do before they run it.

A sensible window is ages 11 to 14. Those are the key stage 3 years, when England's national curriculum for computing (opens in a new tab) asks for at least one textual language. And a blocks-first start does no harm. In a 2019 classroom study (opens in a new tab), the early advantage of blocks faded after the move to Java, but blocks students were not held back either.

Below you get an age guide, five readiness signs, and one sensor project built three ways: as a no-code rule, in Python and in Arduino C++.

What block coding and text coding are

In block coding, every instruction is a shape. You drag it from a palette and snap it into a stack. David Weintrop's column on block-based programming (opens in a new tab) explains the key trick: if two blocks cannot form a valid statement, the editor will not let them snap together. So block programs cannot have syntax errors. The palette also shows every command, so you can browse what is possible. And blocks can use plain words. The same column compares a block that reads "change x by 1" with the Java line x=x+1;.

In text coding, you type every word and symbol yourself, in a strict grammar called syntax. Miss a bracket and the program will not run. In return, you can write anything the language allows, in any editor, and use the same tools professionals use.

Between the two sit tools that show both views:

  • [Microsoft MakeCode](https://makecode.com/about): its blocks map directly to lines of code, and a language editor sits beside the blocks editor. MakeCode's Python page (opens in a new tab) says it uses Python along with JavaScript.
  • [Code.org App Lab](https://code.org/en-US/tools/app-lab): students code in JavaScript with either blocks or text.

Hardware adds a third style. On the MakerBuddy board you do not drag blocks at all. You fill in a rule: watch this sensor, compare it with a number, then run these steps. Our guide to visual programming for hardware shows how those no-code rules teach the same logic as code.

Block coding vs text coding, side by side

How you write
Block coding
Drag and snap blocks with a mouse or finger
Text coding
Type words and symbols on a keyboard
Syntax errors
Block coding
Cannot happen: wrong blocks will not snap
Text coding
Common at first: a missing bracket stops the program
Finding commands
Block coding
Browse the coloured palette
Text coding
Remember them or look them up
Typing needed
Block coding
Almost none
Text coding
All of it
What you can build
Block coding
Whatever the blocks offer
Text coding
Anything the language can do
Feel to students
Block coding
Easier, but can feel less real
Text coding
Harder, but feels like what professionals do
Typical tools
Block coding
Scratch, MakeCode, App Lab blocks
Text coding
Python, JavaScript, C++ for Arduino
On hardware
Block coding
Block editors for small boards, or no-code rules
Text coding
Arduino C++ or MicroPython on the board itself

The "feel" row comes from research. In a 2017 study by Weintrop and Wilensky (opens in a new tab), students who used text saw their work as closer to what professional programmers do. Students who used blocks learned more in the same five weeks. Both groups were equally confident and enjoyed the course equally.

Is block coding real coding?

Yes. A block program has sequence, decisions, loops and logic, and a wrong one still does the wrong thing. Standards agree. The US CSTA K–12 Computer Science Standards (opens in a new tab) ask students in grades 3 to 5 (ages 8 to 11) to create programs that include sequences, events, loops and conditionals. They name the ideas, not the tool. A Scratch program can meet that standard as well as a Python one.

Blocks remove the typing, not the thinking. Get the order wrong and the light stays on all night, in blocks or in C++.

Students do not always believe this. In the classroom interviews behind Weintrop's column, one student said: "There is not a block for everything." A student who thinks their skill is fake may give up. Show the same idea written both ways, so they see their block logic was code all along.

The honest limits of blocks are real, though:

  • Some ideas are missing. Some tools have no variables. MakerBuddy rules, for example, can test sensors and run steps, but they cannot count or remember a number.
  • Long programs get hard to manage. Earlier research found that block tools do not scale well to larger programs, as the 2017 study by Weintrop and Wilensky (opens in a new tab) notes.
  • Standards expect text later. England's curriculum asks for a textual language at key stage 3, and the CSTA standards for grades 11 and 12 ask students to compare programming languages.

What research says about moving from blocks to text

The best-known study ran in a US high school. Two classes of 30 students took the same course with the same teacher. For five weeks, one class used a block version of a tool and the other a text version that could do exactly the same things. Then both classes switched to Java for 10 weeks. The details are in Weintrop and Wilensky's 2019 paper on the transition (opens in a new tab).

What they found:

  1. 1

    After five weeks, blocks were ahead.

    The blocks class scored higher on the concept tests and grew more interested in future computing courses, as the 2017 paper (opens in a new tab) reports.

  2. 2

    After 10 weeks of Java, the gap was gone.

    The difference in concept scores faded, and the two classes wrote Java in the same ways.

  3. 3

    Blocks did not hurt.

    As the CACM column (opens in a new tab) sums it up, the blocks start did not put students ahead in Java, but it did not hamper their transition either.

  4. 4

    Interest moved with the switch.

    The blocks class grew more interested during the blocks weeks, then less interested after the move to Java. The text class did the opposite.

The authors draw a practical lesson about timing. Switching at the very start of a new course risks students dropping out. They suggest switching within a course, once the teacher knows the class, with explicit bridges between the two, or mixing blocks and text through the year. The teacher in the study said she would now introduce each new idea in blocks, then show the same idea in Java.

Keep the limits in mind: one selective high school, 60 teenagers. It shows blocks first is safe, not the perfect age for a 10-year-old.

When should students switch? An age guide

Use this as a starting point, not a rule. Readiness, covered in the next section, matters more than age.

Age
5 to 7
Main way to code
Picture blocks, short programs
What to aim for
Order of steps, cause and effect
Bridge to text
None needed yet
Age
8 to 10
Main way to code
Block editors such as Scratch
What to aim for
Sequences, events, loops and if-then
Bridge to text
Read a few lines of text aloud next to the blocks
Age
10 to 12
Main way to code
Blocks, plus no-code rules on real hardware
What to aim for
AND and OR tests, sensors and thresholds
Bridge to text
A tool that shows blocks and text together
Age
11 to 14
Main way to code
Mix of blocks and first text programs
What to aim for
One text language, rewriting old block projects
Bridge to text
Type out a project you already built in blocks
Age
14 and up
Main way to code
Text as the main tool
What to aim for
Variables, functions, reading other people's code
Bridge to text
Blocks only for quick sketches of an idea

Where the ages come from: Weintrop's column on block-based programming (opens in a new tab) says block tools have been designed for children as young as five, but most target ages 8 to 16. The CSTA standards (opens in a new tab) put sequences, events, loops and conditionals in grades 3 to 5 (ages 8 to 11), and compound conditionals in grades 6 to 8 (ages 11 to 14). The GOV.UK national curriculum page (opens in a new tab) puts key stage 3 at ages 11 to 14, and the computing programme of study (opens in a new tab) asks for two or more languages there, at least one textual. Code.org's App Lab (opens in a new tab), which offers blocks or text, lists ages 13 to 18. The MakerBuddy curriculum is 32 free lessons for ages 10 and up.

Five steps from blocks to text, left to right: picture blocks (ages 5 to 7), a block editor such as Scratch (8 to 10), no-code rules on a real board (10 to 12), Python on a laptop that talks to the board while the firmware stays (11 to 14), and an Arduino sketch that replaces the firmware (14 and up). An amber line between steps 3 and 4 marks the switch when a project needs a variable, and a sixth step above says read the real firmware.
Five steps from blocks to text, left to right: picture blocks (ages 5 to 7), a block editor such as Scratch (8 to 10), no-code rules on a real board (10 to 12), Python on a laptop that talks to the board while the firmware stays (11 to 14), and an Arduino sketch that replaces the firmware (14 and up). An amber line between steps 3 and 4 marks the switch when a project needs a variable, and a sixth step above says read the real firmware.

Five signs a student is ready for text coding

Watch for these in class or at home. Two or three together mean it is time.

  1. 1

    The project needs a variable.

    They want to count visitors, keep a high score or average three readings. Rules and simple blocks cannot remember a number, so the project itself asks for text.

  2. 2

    They predict before they run.

    Ask "what will happen?" before they press go. A student who answers correctly most of the time understands the logic. Typing is the only new thing they have to learn.

  3. 3

    Typing is comfortable.

    Weintrop's column notes that drag and drop removes typing and hunting for odd punctuation. A child who still types one finger at a time will spend the lesson finding the { key, not thinking.

  4. 4

    They ask "how does it really work?"

    A student who wants to see inside the dashboard or the game engine is ready to read code, even before they write much.

  5. 5

    Their block programs are getting long.

    When they copy the same group of blocks again and again, they are ready for the idea of a function, which text handles well.

Signs to wait: frustration with spelling, or projects that blocks still handle well. Pushing text too early can cost you the student's interest.

Worked example: a visitor counter built three ways

The MakerBuddy project ideas library has a Visitor Counter: add 1 each time the motion sensor turns on, and show the total on the text screen. It counts movements, not exact people. The library marks it as an Arduino build, because it needs a variable. That makes it a good switching project.

You need the HC-SR501 motion sensor in the socket marked 18, and the 1602 text screen, which talks to the board over I2C at address 0x27. Lesson 13 covers the motion sensor and Lesson 19 the screen. Always unplug the USB cable before you plug in a part.

Version 1: the no-code rule, and where it stops

Start with what a rule can do. In the dashboard's Rule Engine:

  1. 1

    Add a rule called Someone, with the Condition loop mode.

  2. 2

    Set the sensor to Motion Sensor, the operator to Equal to (==), and choose True.

  3. 3

    Add a step: LCD Display, with your own text Motion: {motion}. The {motion} wildcard shows YES or NO.

  4. 4

    Add a second step: LED On, Value 255. Save the rule.

Walk past the sensor. The screen says YES and the blue light comes on. Lesson 26 teaches this kind of Condition rule.

Now try to count. Look through every step type: lights, buzzer, relay, motor, screen. None of them says "add 1". The screen's wildcards show live readings such as {temp} or {distance}, but there is no counter. Rules have no variables, so they cannot remember how many times something happened.

That wall is the moment to switch. Not a birthday, but an idea that needs a variable.

Version 2: Python on a laptop, with the firmware unchanged

The gentlest first step into text keeps the board exactly as it is. The MakerBuddy firmware has a web API: a laptop on the same Wi-Fi can ask the board for its readings and send it commands. Your Python script does the counting, and the board does the sensing.

You need Python 3 on a laptop, and the board's address. That is its IP address, such as 192.168.1.100, or its name followed by .local, as the versions and addresses table explains. Stop any rule that writes to the screen first, so your script is the only thing changing it.

python
"""MakerBuddy visitor counter over the board's web API.

Runs on a laptop on the same Wi-Fi as the board. The MakerBuddy firmware stays.
"""
import json
import time
import urllib.parse
import urllib.request

BOARD = "http://192.168.1.100"   # your board's IP address or its .local name


def read_sensors():
    with urllib.request.urlopen(BOARD + "/api/sensors", timeout=5) as reply:
        return json.load(reply)


def show_on_screen(line1, line2=""):
    form = urllib.parse.urlencode({"mode": "custom", "text1": line1, "text2": line2})
    with urllib.request.urlopen(BOARD + "/api/lcd", data=form.encode(), timeout=5):
        pass   # sending form data makes this a POST request


visitors = 0          # a variable: the one thing rules do not have
was_moving = False    # what the sensor said last time

show_on_screen("Visitors: 0")
while True:
    moving = read_sensors()["md"]     # md is true while the sensor sees movement
    if moving and not was_moving:     # off to on: a new movement has started
        visitors = visitors + 1
        show_on_screen("Visitors: " + str(visitors))
        print("Visitors:", visitors)
    was_moving = moving   # remember this reading for the next pass
    time.sleep(1)         # the board reads its sensors once a second

How to read it, line by line:

  1. 1

    read_sensors()

    asks the board for a snapshot. In the reply, md means motion detected.

  2. 2

    show_on_screen()

    sends the text to /api/lcd. The screen has 16 columns, so keep each line short.

  3. 3

    visitors = 0

    creates the variable. This one line is what the rule could not do.

  4. 4

    if moving and not was_moving

    counts only the moment motion starts. Without it, one person standing in front of the sensor for five seconds would count five times.

The board's web API has no login, so run this only on a Wi-Fi network you trust, and never open the board to the internet.

Version 3: Arduino C++ on the board

The last step puts text code on the board itself. Now the student owns everything, from reading the pin to drawing the screen.

In the Arduino IDE, pick "ESP32 Dev Module" from "esp32 by Espressif Systems" version 3.x, and install the "LiquidCrystal I2C" library from the Library Manager. We compiled this sketch with core 3.3.7. Our guide to programming an ESP32 with the Arduino IDE walks through the setup.

cpp
// MakerBuddy visitor counter: the project rules cannot build, as Arduino code.
// Board: "ESP32 Dev Module" with "esp32 by Espressif Systems" 3.x.
// Library: "LiquidCrystal I2C", the one the MakerBuddy firmware uses.
// Uploading this sketch replaces the MakerBuddy firmware until you upload it again.

#include <LiquidCrystal_I2C.h>

const int PIR_PIN = 18;   // motion sensor socket
const int LED_PIN = 12;   // built-in blue light

LiquidCrystal_I2C lcd(0x27, 16, 2);   // text screen: address 0x27, 16 columns, 2 rows

int visitors = 0;          // a variable: the one thing rules do not have
bool wasMoving = false;    // what the sensor said last time

void showCount() {
  lcd.setCursor(0, 0);
  lcd.print("Visitors:       ");   // 16 characters, wipes old digits
  lcd.setCursor(10, 0);
  lcd.print(visitors);
}

void setup() {
  Serial.begin(115200);
  pinMode(PIR_PIN, INPUT);
  pinMode(LED_PIN, OUTPUT);
  lcd.init();
  lcd.backlight();
  showCount();
}

void loop() {
  bool moving = digitalRead(PIR_PIN) == HIGH;

  if (moving && !wasMoving) {   // off to on: a new movement has started
    visitors = visitors + 1;
    showCount();
    Serial.print("Visitors: ");
    Serial.println(visitors);
  }

  digitalWrite(LED_PIN, moving ? HIGH : LOW);   // light on while the sensor sees movement
  wasMoving = moving;   // remember this reading for the next pass
  delay(100);           // check ten times a second
}

Put the Python and C++ side by side and ask students to match the lines. visitors = visitors + 1 is identical in both. and not became && !. Python's while True became Arduino's loop(), which runs again and again. The logic did not change. Only the spelling did.

The sketch checks the sensor ten times a second, where the firmware reads once a second. The cost is losing the dashboard, the rules and the live readings. If a student is torn between C++ and Python on the board, our comparison of MicroPython and Arduino C on the ESP32 helps them choose.

The motion sensor's output over 20 seconds, read once a second, while two people walk past: on for 6 seconds, then on for 4. Counting every reading that is on gives 6 + 4 = 10, which is wrong; counting only the two circled off-to-on changes gives 1, then 2, one count per person.
The motion sensor's output over 20 seconds, read once a second, while two people walk past: on for 6 seconds, then on for 4. Counting every reading that is on gives 6 + 4 = 10, which is wrong; counting only the two circled off-to-on changes gives 1, then 2, one count per person.

What changed between the three versions

Where the logic runs
Rule
On the board
Python script
On a laptop
Arduino sketch
On the board
MakerBuddy firmware
Rule
Stays
Python script
Stays
Arduino sketch
Replaced until reinstalled
Can it count?
Rule
No
Python script
Yes
Arduino sketch
Yes
Sensor checks
Rule
Once a second
Python script
Once a second
Arduino sketch
Ten times a second
Typing
Rule
None
Python script
About 25 lines
Arduino sketch
About 40 lines
Works with the laptop closed
Rule
Yes
Python script
No
Arduino sketch
Yes

Reading real code: the firmware behind your rules

There is one more step. The MakerBuddy firmware is open source. It is under GPL-3.0 in the public MakerBuddy-V1 repository (opens in a new tab), as the technical details page explains. The file is Arduino Code/MakerBuddy/MakerBuddy.ino, and in firmware 2.10 it runs to about 4,000 lines.

Nobody should read 4,000 lines on day one. Instead, search the file for evaluateOperator. This short function is where every rule your students built gets decided:

cpp
bool evaluateOperator(float value, SeqOp op, float threshold) {
  switch (op) {
  case SOP_LT:
    return value < threshold;
  case SOP_GTE:
    return value >= threshold;
  case SOP_LTE:
    return value <= threshold;
  case SOP_EQ:
    return abs(value - threshold) < 0.1;
  default:
    return value > threshold;
  }
}

Now hand students the rule form and ask them to match each choice in the operator list to a line:

  • Less than (<) is SOP_LT, which returns value < threshold.
  • Greater or equal (>=) and Less or equal (<=) are the next two cases.
  • Greater than (>) is the default case at the bottom.
  • Equal to (==) is the surprise: abs(value - threshold) < 0.1. "Equal" really means "within 0.1". Ask why. Sensor readings are decimals, and an exact match might never happen.

Curious students can go further. getSensorValueById turns motion into 1.0 or 0.0, so "Motion Sensor equal to True" really means "within 0.1 of 1". evaluateGenericCondition turns AND and OR into && and ||. And getDebouncedCondition waits 300 ms before a rule trusts a change.

This is reading, not writing, and that is the point. A student who can find the line that runs their own rule now understands the tool, not just uses it. The Arduino development notes list the libraries if they later want to build and change the firmware.

The rule form's operator list on the left joined by coloured lines to the cases of the firmware's evaluateOperator function on the right: Greater than goes to the default case, Less than to SOP_LT, Greater or equal to SOP_GTE, Less or equal to SOP_LTE, and the highlighted Equal to (==) to SOP_EQ, which returns abs(value - threshold) < 0.1, so equal means within 0.1, not exactly equal.
The rule form's operator list on the left joined by coloured lines to the cases of the firmware's evaluateOperator function on the right: Greater than goes to the default case, Less than to SOP_LT, Greater or equal to SOP_GTE, Less or equal to SOP_LTE, and the highlighted Equal to (==) to SOP_EQ, which returns abs(value - threshold) < 0.1, so equal means within 0.1, not exactly equal.

A four-week bridge plan for teachers

The 32 MakerBuddy lessons use the dashboard and rules with no code. They do not teach Arduino or the web API, as the page for students who already code says. So treat this plan as an extension for students who finish early, or for a class after the course. Each session fits the 45 to 60 minutes of a normal lesson.

Week
1
Goal
Plan before building
Activity
Draw the visitor counter as a flowchart, then write it as pseudocode
Evidence to collect
A flowchart with a decision and a "remember" box
Week
2
Goal
Read real code
Activity
Find evaluateOperator and match each operator to the rule form
Evidence to collect
A labelled printout of the function
Week
3
Goal
First text program
Activity
Run the Python counter, then change it to count button presses
Evidence to collect
A working script and a note of what changed
Week
4
Goal
Code on the board
Activity
Upload the Arduino sketch, compare it with the Python, then reinstall the firmware
Evidence to collect
Both programs annotated side by side

Week 1 builds on Lesson 20, where students draw flowcharts for a security light. Our guides to pseudocode with examples and algorithmic thinking for kids give more practice. Students who have done Lesson 27 will already know AND, OR and threshold windows, which makes week 2 much easier.

In week 3, the button change tests understanding. The snapshot key for the button is bp, but a quick press can fall between two once-a-second readings. Let students discover that, then ask how the Arduino version could fix it. That question leads into week 4.

Two habits keep the switch calm: show the old rule next to the new text, and ask for a prediction before every run.

If your school is choosing kits for this, the buy now page has the details: in Pakistan a kit is PKR 40,000, ordered online, and schools elsewhere get a written quote.

Common mistakes when students move from blocks to text

The counter jumps by five or more for one person

Cause: The code adds 1 every time it sees moving is true, not when motion starts. The motion sensor's output can stay on for several seconds after movement, depending on its time knob, so one visit counts many times. Our guide to how a PIR motion sensor works explains its time knob.

Fix: Keep the last reading in wasMoving and count only when it changes from false to true.

Every pass counts, even with nobody there

Cause: In C++, if (moving = true) uses one equals sign. That sets moving to true instead of testing it, so the test always passes. Blocks never allowed this mistake, which is why it surprises new text coders.

Fix: Use == to compare, or simply write if (moving). Compile with warnings switched on; the compiler can flag an assignment used as a test.

The Python script stops with a timeout error

Cause: The laptop cannot reach the board. It may be on a different network, such as a guest Wi-Fi, or the .local name may not work on that laptop.

Fix: Put both on the same Wi-Fi and use the board's IP address in BOARD. The fix a problem section covers networks that block devices from talking to each other.

The dashboard stopped working after the upload

Cause: The Arduino sketch replaced the MakerBuddy firmware. This is expected, not a fault.

Fix: Reinstall the firmware with Install by USB. Tell students this before week 4, so nobody thinks they broke the board.

The sketch will not compile because a library is missing

Cause: The error says LiquidCrystal_I2C.h: No such file or directory. The screen library is not installed.

Fix: In the Arduino IDE, open the Library Manager, search for "LiquidCrystal I2C" and install it. Then compile again.

FAQ

Is block coding real coding?

Yes. Block programs use the same ideas as text programs: sequence, decisions, loops and logic. The CSTA standards (opens in a new tab) describe these ideas without naming a tool. Blocks remove syntax errors, not the need to think clearly.

Is block coding easier than text coding?

Usually, yes. In Weintrop's own surveys of high school students who had used both, they overwhelmingly reported block tools as easier, as his column on block-based programming (opens in a new tab) says. The blocks cannot snap together in invalid ways, and the commands are on screen to browse. Easier to start does not mean less valuable; the same logic carries over to text.

At what age should a child switch from block coding to text coding?

A sensible window is 11 to 14, the key stage 3 years when England's curriculum (opens in a new tab) asks for a textual language. Readiness matters more than age: switch when a project needs a variable and the child can predict what their block program will do. A keen 10-year-old may be ready sooner, and a 13-year-old new to coding may want a few weeks of blocks first.

What language does block coding use?

It depends on the tool. MakeCode (opens in a new tab) blocks map to lines of a real language, with a language editor beside them, and its Python page (opens in a new tab) says it uses Python too. App Lab (opens in a new tab) blocks are JavaScript. Others, like Scratch, are block-based environments in their own right, as Weintrop's column on block-based programming (opens in a new tab) describes.

Does Code.org use block coding?

Yes. Code.org's App Lab (opens in a new tab) lets students code in JavaScript with either blocks or text, and lists ages 13 to 18. That makes it one of the tools that can bridge the switch inside a single course.

Can a 17 year old use Scratch?

Yes. Nothing stops an older student using Scratch, and it is a quick way to sketch an idea before coding it. But most block tools are designed for ages 8 to 16, according to Weintrop's column on block-based programming (opens in a new tab). So a 17-year-old who wants to study computing will get more from a text language soon.

How can I learn block coding?

Start with a free block editor and a small goal, such as an animation that reacts to a key. Then move to blocks or rules that control real parts, so you see logic act on the world. The MakerBuddy curriculum teaches no-code rules on a real board, and our guides to if-then statements with real sensors and forever, timed and conditional loops show the logic behind them.

Should my child learn Python or Scratch first?

For most children under about 11, start with blocks such as Scratch, then move to Python. The research found that a blocks start did no harm to later text learning, as the 2019 transition study (opens in a new tab) reports. An older beginner who types well and has a clear project can start in Python directly. More guides like this are on the MakerBuddy blog.

Can you use block coding with Arduino or ESP32?

On the MakerBuddy board, which is built on an ESP32, you use no-code rules in a browser instead of blocks. When a project outgrows them, you move to Python over the web API or to Arduino C++, as in the visitor counter above. Our guide to the 16x2 LCD screen covers the screen used in that project.

Sources

Keep reading

Learn with MakerBuddy

32 free lessons, one kit, no wiring to start.

Every part in these guides has its own lesson. Read them free, or get a kit for your class.