Skip to content
PlayOwl

Coding · Grade 9

Functions and Modular Design

Using a fictional fitness-tracker app, learners trace calls between functions with the call stack, control scope by passing parameters and returning results instead of using globals, write precise contracts with preconditions and postconditions, and separate pure functions from side effects. They then design programs top-down, build them bottom-up and plan a modular program in a reviewed design task.

  • 4 lessons
  • About 90 minutes
  • Check what you learned: 8 questions
  • Ways to answer: choose an answer, put code in order, trace code, match pairs, sort into groups and true or false
Try it now (no account) One of the five free starter courses Open in PlayOwl

What learners will discover

  • Define functions with parameters and return values, and trace nested calls using the call stack.
  • Explain local and global scope and design functions that communicate through parameters and return values.
  • Write function contracts with preconditions and postconditions, and distinguish pure functions from functions with side effects.
  • Design programs top-down as single-responsibility functions and remove duplication with helpers.

Lessons

  1. Functions and the flow of calls 6 steps3 practiceabout 22 min
  2. Scope 5 steps3 practiceabout 20 min
  3. Contracts and pure functions 5 steps3 practiceabout 20 min
  4. Top-down modular design 5 steps3 practiceabout 20 min
  5. Check what you learned 8 questions at the end

Keep exploring

More 9th grade coding

Guide for grown-ups