Small Group Tutorials

Here to help students catch up, keep up, and move ahead. Book a consultation here.

How Can G2 Computing Tuition Help My Child Use a Custom Block Instead of Repeating the Same Code?

Three learners review open books together at a classroom table, with stacks of textbooks, stationery and a whiteboard in the bright room.

Did you know? A custom block is useful because it gives a meaningful name to a reusable group of instructions. G2 Computing tuition can help a child stop copying the same long stack by teaching them to notice a repeated purpose, package it once, and call it where needed. The aim is clearer reasoning, not fewer blocks at any cost.

The quickest next step is to open one recent visual program and mark every instruction stack that appears twice. Ask: “Do these steps always belong together, and can we name what they achieve?” If the child cannot name the job, creating a custom block too early may simply hide confusion.

G2 is the subject level, not the same thing as Posting Group. A student may enter secondary school through PG1, PG2 or PG3 and still take Computing or another subject at a different offered G level. G2 Computing is also a school offering, so families should confirm availability rather than assume every school or tuition provider teaches it.

G2 Computing • Programming structure

Name a repeated job, then reuse it

The teaching sequence is pattern first, purpose second, definition third, call fourth, test last. That order keeps abstraction understandable.

Diagnose whether repetition is really the problem

Repeated code can come from three different weaknesses. The child may not recognise that two stacks are equivalent. They may recognise the repetition but not know how to define a custom block. Or they may be using repeated blocks to compensate for an unclear game design. The repair differs.

  • Pattern check: Highlight instructions that perform the same job in more than one place.
  • Boundary check: Decide where that job begins and ends.
  • Naming check: Give the job a verb-led name such as “reset player” or “show next question”.
  • Trace check: Predict the state before and after the job runs.
  • Need check: Confirm that reuse or clarity improves; do not abstract a one-off stack merely to look sophisticated.

A useful custom block has a coherent responsibility. A vague block called “do stuff” saves space but removes meaning. A precise name lets the student read the main script as a plan.

Back to contents

Decide what belongs inside the custom block

Ask one question: Which instructions should always travel together? Suppose a game resets the player by moving the sprite to a start point, setting its direction, restoring its size and setting speed to the starting value. If the same reset is needed after a collision, after a restart button and when a new round begins, those instructions form one reusable job.

The block boundary should exclude instructions that do not always belong. Playing a celebration sound may happen after a completed round but not after a collision. Putting that sound inside “reset player” would create an unwanted side effect. Good abstraction is as much about what stays outside as what moves inside.

Before changing the program, the student writes a small contract: “When reset player finishes, position, direction, size and speed are back at their starting values.” This makes testing possible.

Back to contents

Refactor a repeated game routine

Imagine three scripts each contain the same four reset instructions. The child first traces one script and records the starting state. Next, they create a custom block named reset player, move the four instructions into its definition, and replace each repeated stack with one call.

Now test the three calling situations separately: collision, restart and new round. A program that works in one path can still fail in another because a variable was not reset or an instruction was placed in the wrong order. The child should compare actual state with the written contract after each call.

This example shows why “shorter code” is not the main victory. The top-level scripts now communicate intention: when an event happens, reset the player. The details live in one defined place. A later correction can be made once rather than inconsistently across three copies.

For extension, change the requirement. What if a new round should preserve speed? That question may reveal that one custom block is doing two jobs. The student might need a smaller reusable block or a separate round-start routine. Refactoring is a decision, not a ritual.

Back to contents

Do not confuse a custom block with an event or a message

Visual languages place several kinds of block near one another, so role confusion is common. A custom block groups instructions behind a name and runs when called. An event starts a script when something happens, such as a key press. A broadcast message can trigger other scripts and sprites. These mechanisms can cooperate, but they are not interchangeable.

  • Custom block: “Run this named procedure here.”
  • Event: “Start when this condition or action occurs.”
  • Broadcast/message: “Notify other scripts to begin their response.”

A tutor should ask the student to point to where the custom block is defined and every place it is called. Then ask which event begins the larger sequence. This reveals whether the program’s control flow is visible in the child’s mind.

Back to contents

Debug the definition and the calls separately

When refactored code fails, students often edit everywhere at once. A calmer method separates two questions. First, does the custom block work correctly when called from a tiny test script? Second, does each event call it at the right moment with the right starting state?

  1. Create a minimal test call.
  2. Record relevant variable and sprite state before the call.
  3. Run the custom block once.
  4. Compare the result with its contract.
  5. Only then test each calling script.
  6. If one path fails, inspect the state entering the call before changing the definition.

This preserves causality. The child learns whether the fault belongs inside the reusable job or in the surrounding sequence. That distinction supports later programming, even when the language changes.

Back to contents

How this aligns with the 2027 G2 Computing syllabus

SEAB’s 2027 G2 directory lists the new G2 Computing syllabus as K237, with its first examination in 2027. The 2027 G2 Computing K237 syllabus explicitly includes creating and using functions/custom blocks to represent more complicated instructions made from multiple blocks. It also includes variables, conditionals, loops, lists or arrays, program-error correction and game-programming events.

K237 has a 50% e-examination paper covering all six modules and a 50% lab-based paper covering spreadsheets, media software and programming. Custom-block practice should therefore include explanation and practical construction. A student who can click through a prepared file but cannot explain the call sequence is not yet secure.

The official listing does not mean every school offers G2 Computing, and it does not confirm that a particular tuition provider does. Check the school’s approved software and current teaching sequence as well as the syllabus document.

Back to contents

How a conditional three-student lesson can help

If the provider actually offers G2 Computing and the format is a three-student class, each learner can refactor a different routine. One names the job, one predicts the state after the call and one tries to invent a case that breaks the proposed boundary. Roles rotate so every student must define, trace and challenge.

The tutor should resist fixing the program immediately. A short think-aloud—“I expect x, y, direction and speed to become…”—usually exposes the misconception faster. The group adds useful test cases, while the code and explanation remain each learner’s own.

Back to contents

Check independent progress on a fresh program

Remove the worked example and give a new script with two repeated patterns, only one of which deserves a custom block. Progress is visible when the student can:

  • spot meaningful repetition without being told where it is;
  • choose a boundary that keeps one coherent responsibility;
  • name the block by its purpose;
  • predict state before and after the call;
  • distinguish the definition from the calling scripts;
  • test multiple paths and localise an error; and
  • explain why the refactor improves clarity or maintenance.

The final sign of transfer is restraint. A student who sometimes decides not to create a custom block—because the stack is one-off or the proposed group has no coherent job—is showing judgement, not reluctance.

Back to contents

Read the next guide

For the larger question of correctness, read Why Can My Child Write Code That Runs but Still Lose Computing Marks? For step-by-step state tracking, continue with How Can G2 Computing Tuition Help My Child Trace a Program Without Guessing the Output? The series directory keeps subject levels and syllabus years together.

A useful question for the next program is: “What job repeats, and what must be true when that job finishes?”

Continue from here: Start Here · Tuition · Education · Pathways · Parenting 101 · All Site Routes

eduKate Punggol

Contact

83 Punggol Central, Singapore 828761

edu|Kate Bukit Timah

8 Fourth Avenue, Singapore 268674

By Appointment +65 8823 1234
admin@edukatesg.com

Email Us

When a child finally understands, school becomes less frightening and the future opens wider. Email us for the latest schedules and fees.

← 返回

感谢您的回复。 ✨