Teacher Boen Resource Library · Kenya CBC/CBE
Grade 9 · Pre-Technical Studies

2.2 Visual Programming

Additional revision · Strand 2.0 Communication in pretechnical studies

2.2.1 What is Visual Programming?

Visual programming is a way of creating computer programs by dragging and dropping graphical blocks (like puzzle pieces) instead of typing lines of text code. This makes programming easier, especially for beginners.

Examples of visual programming applications:

  • Scratch
  • Microsoft MakeCode
  • SpriteBox
  • Blockly

2.2.2 Application Areas of Visual Programming Software

Area

Example

Education

Teaching programming concepts to children

Game development

Creating simple 2D games (e.g., racing, platform games)

Storytelling and animations

Making interactive stories or cartoons

Simulations

Simulating scientific experiments or physics

Robotics

Programming robots (e.g., LEGO Mindstorms, micro:bit)

Mobile apps

Simple app prototyping (e.g., Thunkable, App Inventor)

2.2.3 Features of Visual Programming Environments

  • Blocks palette – categories of blocks (motion, looks, sound, events, control, sensing, operators, variables).
  • Script area – where blocks are assembled to create code.
  • Stage – where the output (animation, game) is shown.
  • Sprite list – characters or objects in the program.
  • Backdrop – background scene.

2.2.4 Creating an Application Using Visual Programming

Example (Scratch) – an interactive story:

  1. Choose a backdrop (e.g., forest).
  2. Add a sprite (e.g., a cat).
  3. Add code blocks in sequence:
  • When green flag clicked
  • Say "Hello, I am a forest explorer!" for 2 seconds
  • Move 50 steps
  • Play sound "meow" until done
  • Say "Let's find the treasure!" for 2 seconds

Example – a simple game (catch the ball):

  • Sprite 1 (catcher) moves left/right with arrow keys.
  • Sprite 2 (ball) falls from top.
  • If the catcher touches the ball, increase score and play a sound.

2.2.5 Problem‑Solving with Visual Programming

Problem: Create a program that asks the user for two numbers and displays their sum.

Blocks (Scratch):

  • ask "Enter first number" and wait → set variable num1 = answer
  • ask "Enter second number" and wait → set num2 = answer
  • set sum = (num1 + num2)
  • say "The sum is " & sum

2.2.6 Activity

  • Launch Scratch or MakeCode. Explore the different block categories.
  • Create an interactive animation of your choice (e.g., a dancing sprite, a racing game, or a quiz).
  • Share your project with a classmate and get feedback.
  • Discuss in groups: How can visual programming be used to solve a problem in your school (e.g., a digital timetable, a simple calculator)?

2.2.7 Key Inquiry Question

How are applications developed using visual programming software?