← Back to course
Code Crew G3 / Week 11 / Friday
5/6
Week 11 Β· Decomposition

Friday

// Breaking it down

Friday: Mini-Project

"A whole day is a big problem," Raven says. Rocket grins. "Then let's turn it into functions! Wake up, eat, play and sleep."

"What small steps are inside each one?" Raven asks. Rocket thinks about getting dressed. Shirt, socks, shoes!

Nova projects a list. "Give each function two steps," she hints. Let's plan tomorrow, one function at a time.

Decompose a Whole Day

Plan tomorrow as a day full of tiny functions.

List at least 6 'functions' your day uses (wake_up, eat, school, play, dinner, sleep).

Then write 2 SUBTASKS inside each.

1. _________ () β†’ __________________ , __________________
2. _________ () β†’ __________________ , __________________
3. _________ () β†’ __________________ , __________________
4. _________ () β†’ __________________ , __________________
5. _________ () β†’ __________________ , __________________
6. _________ () β†’ __________________ , __________________

Reflection

Day Plan Check

FUNCTIONS IN YOUR DAY
  • Read the question.
  • Tap your answer.
wake_up() has the subtasks get up and stretch. How many subtasks?
Which function holds put on pajamas?
A day has 6 functions with 2 subtasks each. How many subtasks?
Which skill turns a day into functions?
school() has 3 subtasks. play() has 2. How many subtasks in all?
Which fits in morning(): brush teeth or bedtime story?
A plan has 4 functions with 3 subtasks each. How many subtasks?
StatementTrue or false?
A day can be broken into functions.?
Each function can have its own subtasks.?
Subtasks have to be the same in every function.?
Planning tomorrow in parts can make it easier.?
WHY THIS EXERCISEDecomposing a day is good practice for decomposing a program.

Quick Check

The bedtime function has these subtasks: brush teeth, put on pajamas, read a book. How many subtasks is that? ____
The morning function has: wake up, eat breakfast. Which function holds read a book? ____
← Thursday