Why Block-Based Programming Exists
Quick answer Text-based languages punish beginners with syntax errors. Block-based languages such as Scratch hand you ready-made instruction blocks so that all your attention goes to the logic.
A program is a set of instructions written in a language that a computer can follow, and the person who writes it is a programmer. Before a single instruction is typed or dragged, the programmer must work out the algorithm — a finite, step-by-step method that solves the problem in a definite order.
Most programming languages are text-based. In a text-based language such as Python, Java or C++, every instruction is typed as a line of text and must obey the grammar of that language exactly. Miss a bracket or spell a keyword wrongly, and the computer reports a syntax error — an error caused by breaking the grammar rules of the language — and refuses to run the program at all. A beginner can then lose a whole lab period hunting a missing semicolon instead of learning logic.
Block-based programming, also called visual programming, was created to remove exactly that obstacle. Instructions come as ready-made blocks shaped like jigsaw pieces; the learner drags one out of the palette and snaps it under another. Because the wording, spelling and punctuation are already printed inside the block, a syntax error is impossible. Because every block has a shape, blocks that do not belong together simply refuse to join. The learner's attention goes entirely to the part that matters: what should happen, in what order, under what condition, and how many times.
Scratch is the best known block-based language. It was developed by the Lifelong Kindergarten group at the MIT Media Lab and is free to use. It runs in a web browser or as an offline editor installed on the computer, so a lab with a slow connection can still use it. A piece of work made in Scratch is called a project. In current versions a saved project file carries the extension .sb3; older versions used .sb2, so quote the extension only if your textbook does.
Advantages an examiner expects you to list: syntax errors cannot happen; the output is visible immediately on the stage, so a mistake in logic is spotted at once; blocks are colour-coded, so the right instruction is easy to find; sound, pictures and animation are built in; and the same three control structures — sequence, selection and iteration — reappear in Python and Java, so the thinking transfers.
Know the limits as well, because a state two limitations question is common. Dragging is slower than typing, so long programs are tiring to build; large scripts become hard to read; block languages are not normally used to build professional software; and, apart from a few ready-made extensions, they do not work easily with files, databases or hardware. Scratch is a learning language — the logic it teaches is later rewritten in a text-based language.
What the examiner wants: define block-based programming as a way of writing programs by dragging and joining ready-made instruction blocks instead of typing text, and then give one advantage in your own words.
- A program is a set of instructions; an algorithm is the step-by-step logic behind it.
- A syntax error is an error caused by breaking the grammar rules of a language.
- Block-based (visual) programming uses ready-made jigsaw blocks, so syntax errors cannot occur.
- Scratch was developed by the Lifelong Kindergarten group at the MIT Media Lab and is free.
- Advantages: no syntax errors, instant visual output, colour-coded blocks, logic transfers to Python.
- Limitations: slow for long programs, not normally used for professional software, weak file and hardware handling.
