Skip to content
SPM Tuition
Study problem · Computer Science

I can read code but cannot write it

You follow every line of a teacher's program but freeze at a blank page.

Reading code means following choices someone else made. Writing means making those choices yourself, and that needs a planning routine, not more syntax.

This page is for the moment you face a task and cannot begin. The routine below bridges the gap between the words of the task and the first line of code.

Why does reading feel easier than writing?

When you read, the variables already exist and the steps are in order. When you write, you must first decide what to store, what repeats, and when to stop.

Students skip those decisions and look for a line to copy. The fix is to make the decisions on paper before any code appears. This connects to breaking a problem into smaller tasks.

What is the five-step routine?

  1. Write the task in your own words.
  2. List the inputs and the outputs.
  3. Decide what must be stored while the program runs.
  4. Write the steps in plain words.
  5. Turn each step into pseudocode, then trace it on a tiny example.

A worked example

Task. Five test marks are entered. Display how many marks are 50 or above.

Steps 1 to 3. The inputs are five marks. The output is one count. One variable, passCount, must be stored, starting at 0.

Step 4. Repeat five times: read a mark, and if it is at least 50, add 1 to passCount. After the loop, output passCount.

Step 5.

passCount ← 0
FOR i ← 1 TO 5
   INPUT mark
   IF mark >= 50 THEN
      passCount ← passCount + 1
   END IF
END FOR
OUTPUT passCount

Trace it with the marks 48, 50, 72, 39 and 65. The count moves 0, 1, 2, 2, 3, so the output is 3. The value 50 counts, because the test is “at least 50”.

How can you practise without copying?

Take a short program from your notes and trace it with a table. Close the notes, read only the table, and rebuild the code from it. Compare your version with the original and note the first line that differs.

Use the restricted pseudocode trace trainer for tracing practice, and log the slips in the mistake log. Then move to programming foundations for loops and selection lessons.

A self-check

Write the five steps for this task: input four temperatures and output the highest. Then ask which variable you must store, and what its starting value should be.

The answer is that you store highest, and start it at the first temperature, not at 0, in case every reading is below zero.

When is one-to-one tuition worth considering?

If you have tried the routine and still cannot begin, the gap is probably step 3, deciding what to store. A teacher can listen as you explain your plan aloud and stop you at the exact decision that stalls.

You can test this in the one-hour trial class (from RM50), a taught lesson on the topic you choose. See also online one-to-one Computer Science tuition.

Common questions

Why can I read code but not write it?

Reading follows decisions that someone else already made. Writing requires you to make those decisions: what to store, what to repeat and when to stop. Practising the planning steps builds that skill without needing any new syntax.

Should I memorise programs from the textbook?

Memorising a program helps only for that exact task. A better method is to rebuild it from its purpose. Cover the code, write what it should do, and plan the variables and steps. Then compare with the original.

Do I need to type code to practise writing?

Not at first. Writing pseudocode or code on paper trains planning and structure. Running on a computer is useful for checking afterwards. Writing by hand slows you down enough to see your own plan clearly.

How long before I can write programs alone?

It depends on the starting point and how regularly you practise. You will know you are getting there when you can plan the variables and steps for an unfamiliar small task without looking. Short, frequent practice moves this faster than long gaps.

If the blank page is the problem, a one-to-one Computer Science teacher can watch how you start and coach the planning step that turns a task into code.

  • Online one-to-one lessons for your child with an experienced teacher.
  • Your first class is a one-hour trial, from RM50. The fee is agreed before you book.
  • Happy with the teacher? Continue with lessons of about 1.5 hours. If not, ask for another teacher.