Skip to content
Technologies · Year 7

Active learning ideas

Functions: Modularizing Code

Functions help students see code as a set of tools rather than a single sequence. Active learning lets them build, test, and refine these tools together, turning abstract concepts into concrete skills they can explain and reuse.

ACARA Content DescriptionsAC9TDI8P03
25–45 minPairs → Whole Class4 activities

Activity 01

Peer Teaching30 min · Pairs

Pair Challenge: Function Builder

Pairs receive a task like drawing a house; they write separate functions for walls, roof, and door, then combine them. Test by calling functions with different parameters. Discuss how changes in one function affect the whole without rewriting.

Construct a program that utilizes custom functions to perform specific tasks.

Facilitation TipDuring Pair Challenge: Function Builder, circulate to listen for students describing the purpose of each function block before they test it.

What to look forPresent students with a simple program without functions that performs a repetitive task. Ask them to identify the repeated code and then rewrite a section of the program using a custom function, explaining their choices.

UnderstandApplyAnalyzeCreateSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 02

Peer Teaching45 min · Small Groups

Small Group Refactor Relay

Provide messy code with repeated sections to small groups. Each member writes a function for one repeated part, then passes to the next for integration. Groups race to run the refactored, cleaner version successfully.

Explain the benefits of modular programming using functions.

Facilitation TipIn Small Group Refactor Relay, set a timer so groups focus on one function at a time, preventing overwhelm.

What to look forOn a slip of paper, ask students to define 'function' in their own words and provide one reason why using functions makes programming easier. They should also list one example of a task that could be put into a function.

UnderstandApplyAnalyzeCreateSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 03

Gallery Walk40 min · Whole Class

Whole Class Function Gallery Walk

Students create one function solving a shared problem, like user input validation, and post screenshots. Class walks around, calls each other's functions in their programs, and votes on the most reusable.

Analyze how parameters and return values facilitate communication between functions.

Facilitation TipFor Whole Class Function Gallery Walk, ask students to leave sticky notes with one question or compliment per displayed program to guide reflection.

What to look forPose the question: 'Imagine you are building a program to simulate a day at school. What are three distinct tasks you could create as separate functions?' Encourage students to think about parameters and return values for each task.

UnderstandApplyAnalyzeCreateRelationship SkillsSocial Awareness
Generate Complete Lesson

Activity 04

Peer Teaching25 min · Individual

Individual Debug Quest

Give programs with broken functions; students identify issues, fix parameters or returns, and add their own function. Share one fix with the class via quick demo.

Construct a program that utilizes custom functions to perform specific tasks.

Facilitation TipIn Individual Debug Quest, provide error messages in red on printed code so students practice interpreting them systematically.

What to look forPresent students with a simple program without functions that performs a repetitive task. Ask them to identify the repeated code and then rewrite a section of the program using a custom function, explaining their choices.

UnderstandApplyAnalyzeCreateSelf-ManagementRelationship Skills
Generate Complete Lesson

A few notes on teaching this unit

Start with concrete examples students can trace by hand, like drawing shapes or calculating scores, before moving to code. Avoid skipping the step where students explain why a function exists or what it returns. Research shows pairing explanation with code creation deepens understanding of modularity and scope.

Students will confidently define functions, pass parameters, and use return values to simplify programs. Success looks like clear explanations of why modularization matters and the ability to debug or refactor code with functions.


Watch Out for These Misconceptions

  • During Pair Challenge: Function Builder, watch for students who define functions but never call them in main. Redirect by asking, 'If you never call this, how will your program run it?'

    Have pairs write a main section first that calls all their functions by name, then trace the flow together to see missing calls.

  • During Small Group Refactor Relay, watch for students treating parameters like global variables they can change anywhere. Redirect by asking, 'If you change this value inside the function, does it affect the rest of the program?'

    Provide a simple program where changing a parameter inside a function does not alter other outputs, then ask groups to explain why.

  • During Whole Class Function Gallery Walk, watch for students assuming return values always print to the screen. Redirect by asking, 'If this function returns a value, where does that value go next in the program you’re viewing?'

    Ask students to trace a returned value from one function into another function’s parameter, using arrows on printed code to mark the flow.


Methods used in this brief