Skip to content
Technologies · Year 9

Active learning ideas

Modular Design with Functions

Active learning helps students grasp modular design because programming tasks feel abstract until they manipulate real code. Breaking problems into functions becomes tangible when students physically reorganize lines, rename blocks, and test each piece. This hands-on approach builds confidence that theory alone cannot provide.

ACARA Content DescriptionsAC9DT10P02AC9DT10P03
20–45 minPairs → Whole Class4 activities

Activity 01

Problem-Based Learning30 min · Pairs

Pair Programming: Refactor a Monolith

Provide students with a long script full of repeated code, such as a basic calculator. In pairs, identify duplicate sections, extract them into functions with parameters, test each function separately, then integrate and run the full program. Pairs present one key change and its impact.

Analyze how modularity improves the reliability and readability of a program?

Facilitation TipDuring Pair Programming: Refactor a Monolith, require students to track line counts and error logs before and after refactoring to make the benefits of modularity visible.

What to look forProvide students with a short Python script that performs a simple task (e.g., calculating the area of different shapes). Ask them to identify one section of code that could be refactored into a function and explain why. For example: 'Identify the code block that calculates the area of a rectangle. Explain how turning this into a function named 'calculate_rectangle_area' would improve the code.'

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 02

Problem-Based Learning45 min · Small Groups

Small Groups: Modular Problem Solver

Groups receive a complex task like simulating a simple inventory system. Brainstorm steps, assign functions for tasks like addItem or checkStock, pseudocode first, then code and test collaboratively. Demo the modular program to the class.

Compare the trade-offs between writing a custom function and using a pre-existing library?

Facilitation TipFor Small Groups: Modular Problem Solver, ask each group to swap their final functions with another group to test and debug, reinforcing reliability through peer review.

What to look forPose the question: 'Imagine you are building a simple calculator program. What are three distinct tasks you could create separate functions for? For each function, what input (parameters) would it need, and what output (return value) would it provide?'

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 03

Problem-Based Learning25 min · Whole Class

Whole Class: Custom vs Library Challenge

Display code scenarios needing sorting or input validation. Class votes on custom function versus library use, then codes both versions live on the board. Discuss runtime, readability, and adaptability as a group.

Design a strategy to break a complex problem into reusable steps.

Facilitation TipIn Whole Class: Custom vs Library Challenge, provide identical starter code with two paths—one using built-in functions, one using custom functions—so students can directly compare trade-offs.

What to look forAsk students to write down one benefit of using functions in programming and one potential drawback or trade-off when deciding whether to create a new function or use existing code. For instance: 'Benefit: _______ Drawback: _______'

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

Activity 04

Problem-Based Learning20 min · Individual

Individual: Decomposition Mapping

Students pick a real-world process like planning a trip, list steps on paper, group into reusable functions with inputs/outputs. Convert to pseudocode, then implement one in a simple script and self-test.

Analyze how modularity improves the reliability and readability of a program?

Facilitation TipFor Individual: Decomposition Mapping, have students submit their diagrams alongside a brief written explanation of how each module interacts with others.

What to look forProvide students with a short Python script that performs a simple task (e.g., calculating the area of different shapes). Ask them to identify one section of code that could be refactored into a function and explain why. For example: 'Identify the code block that calculates the area of a rectangle. Explain how turning this into a function named 'calculate_rectangle_area' would improve the code.'

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
Generate Complete Lesson

A few notes on teaching this unit

Teach modular design by having students experience the pain of spaghetti code first, then guide them toward breaking problems into functions. Use concrete examples with measurable outcomes, like line counts and error logs, to prove modularity’s value. Avoid overwhelming students with abstract theory; instead, let them discover principles through structured activities and peer feedback.

Successful learning looks like students confidently splitting tasks into functions, explaining parameter use, and justifying code organization choices. They should measure improvements in readability and error rates, and articulate when to reuse functions versus library code.


Watch Out for These Misconceptions

  • During Pair Programming: Refactor a Monolith, some students may resist breaking code into functions, arguing that it makes the program longer.

    Have students compare the line count and error log of the original monolithic script to their refactored version. Ask them to calculate the reduction in lines and count the errors after modularization to demonstrate that fewer lines and errors result from proper function use.

  • During Whole Class: Custom vs Library Challenge, students may default to using library functions without considering custom needs.

    Assign half the class to use library functions and the other half to write custom functions for the same task. After completing the challenge, hold a structured debate where groups present trade-offs based on flexibility, readability, and error handling.

  • During Small Groups: Modular Problem Solver, students might think functions cannot handle varied or complex inputs.

    Give each group a set of diverse inputs to pass to their functions, such as integers, strings, and mixed data types. Ask them to observe how parameters allow the same function to process different data correctly, then peer review each other’s parameter handling.


Methods used in this brief