Home›Lesson Plans›Computer Science›Programming · Grade 10

Designing Good Functions

Tenth graders learn what makes a function well-designed — it does one clear job, has a descriptive name, is short and focused, and returns useful values. Good functions make programs easier to read, reuse, and debug. They sort good design from poor, then refactor a function.

Grade 10Designing Good Functions50 minutes1 class periodCSTA / ISTEExplicit teaching4 StandardsCSTA
Start the Lesson
Assign or share this lesson

Copy link works with Canvas, Schoology, Moodle and any other LMS — paste it in as a resource or assignment.

Lesson at a Glance

Everything you need before the bell rings

Learning Objectives

Students will be able to…

  • ✓Design one-job functions.
  • ✓Use clear names.
  • ✓Keep them short.
  • ✓Refactor a function.
Essential Question

What makes a function good to use, read, and reuse?

0
Lesson Phases
0
Vocabulary Terms
0
Standards Aligned
0
Interactive Task
Sort It · Interactive

Good Function, or Poor?

Project this and sort each into Good function design or Poor.

⚙️ Sort each — good function design, or poor?Try it
✨ Good function
👎 Poor
Tap one, then tap a box.
The Lesson · Explicit teaching

50 minutes, five moves

Tap any phase to open the teacher moves and student actions.

1

Hook — One Job

5 min

A function called doEverything() — is that a good idea?

👩‍🏫 Teacher Moves

  • Pose the question.
  • Share ideas.
  • Set the goal.

🎒 Student Actions

  • Think.
  • Share.
  • Get ready.
2

Use — Function Design

12 min

Students learn.

👩‍🏫 Teacher Moves

  • Send students to Good Function or Poor?
  • Sort each one.
  • Note one clear job.

🎒 Student Actions

  • Sort.
  • Say.
  • Note it.
3

Modify — Design It

13 min

Students practice.

👩‍🏫 Teacher Moves

  • Name a function clearly.
  • Give it one job.
  • Return a value.

🎒 Student Actions

  • Name.
  • Focus.
  • Return.
4

Create — Create

15 min

Students apply.

👩‍🏫 Teacher Moves

  • Refactor a messy function.
  • Split it into smaller ones.
  • Name each well.

🎒 Student Actions

  • Refactor.
  • Split.
  • Name.
5

Reflect — Reflect

5 min

Students close.

👩‍🏫 Teacher Moves

  • Name a good-function trait.
  • Name a poor one.
  • Complete the exit ticket.

🎒 Student Actions

  • Name one.
  • Name one.
  • Complete the exit ticket.
Standards Alignment

Built to the standards you report on

Aligned to the CSTA K-12 Computer Science Standards and the ISTE Standards for Students.

CSTA
3A-AP-17

Use modularity and well-designed functions.

CSTA
3A-AP-18

Document and name code clearly.

CSTA
3B-AP-14

Construct well-structured programs.

ISTE
6

Communicate clearly through code.

Differentiation

One lesson, every learner

Multilingual Learners

ELL / EMERGING READERS
  • Good/poor function cards.
  • Frame: "a good function does ___."
  • Compare two functions.

Support & Access

IEP / 504
  • Sort good vs poor only.
  • Use 4 traits.
  • Use clear examples.

Stretch & Extend

GIFTED / EARLY FINISHERS
  • Refactor a long function.
  • Write a docstring.
  • Review a peer’s functions.
Materials

What to gather

  • 📽️Screen / board
  • ⚙️Function cards
  • 💻Good Function or Poor?
  • 📄Messy function snippet
  • 📓Notebooks
  • 🎫Exit-ticket slips
Vocabulary

Key terms — hover for a quick definition

functiona named reusable blockone joba single clear purposedescriptive namea name that says what it doesreturnsend back a valueparameteran input to a functionrefactorclean up without changing behaviormodularbuilt from small partsside effecta hidden change elsewhere
Evaluate

Exit Ticket

Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students.

QUESTION 1
Name a trait of a good function.
One clear job, descriptive name, short, returns useful values.
QUESTION 2
Name a poor one.
Does too many things, vague name, or hundreds of lines long.
QUESTION 3
Why design good functions?
They make code easier to read, reuse, and debug.

Reflect: designing good functions.

Have students refactor a messy function into smaller ones. A printable snippet sheet is in the CS library.

Study · Flashcards

Study the key terms

Tap a card to flip it, then rate whether you knew it. Built from this lesson’s vocabulary.

🃏 Designing Good FunctionsFlip
Card 1
Term
Tap to flip →
Meaning
0

Nice work!

Practice · Quiz

Check your understanding

A quick self-check with instant feedback, drawn from this lesson’s key terms.

📝 Designing Good FunctionsQuiz
Score: 0
1 / 6
Question 1
0%

Nice work!

Practice · Worksheet

Printable worksheet

A print-and-go review sheet with a built-in answer key. Tap “Show answer key” to reveal answers, or print the clean version for students.

🖨️ Designing Good FunctionsPrint
Name: ________________________
Date: ____________

Part A · Write the word that matches each meaning

Word bank: descriptive name, function, modular, one job, parameter, refactor, return, side effect
  1. a name that says what it does
  2. a hidden change elsewhere
  3. clean up without changing behavior
  4. an input to a function
  5. a single clear purpose
  6. built from small parts
  7. send back a value
  8. a named reusable block

Part B · Show what you learned

  1. Name a trait of a good function.
  2. Name a poor one.
  3. Why design good functions?
Answer key — Part A: 1) descriptive name · 2) side effect · 3) refactor · 4) parameter · 5) one job · 6) modular · 7) return · 8) function
Part B: 1) One clear job, descriptive name, short, returns useful values. 2) Does too many things, vague name, or hundreds of lines long. 3) They make code easier to read, reuse, and debug.