Class 7 · CBSE AI · Strand B — Python for AI

How to read other people's code — a real coding skill for Class 7

Developers read far more code than they write. Why reading code is its own skill, and how to get good at it. For Class 7.

What this concept actually says

  • Reading code is a skill separate from writing code — professional developers read far more code than they write
  • Understanding unfamiliar code requires a systematic approach: start with the overall structure, then trace the data flow, then examine individual functions
  • Comments and docstrings are contracts the original developer made with future readers — their absence is a warning sign

An analogy your child will recognise

Reading a textbook by a different teacher

When you read a textbook written by someone else, you cannot ask them to explain. You read the headings first to get the structure, then the examples to understand the intent, then the details. Reading code uses the same strategy: structure first, examples second, details third.

Inheriting someone's kitchen

If you move into a house and the previous owner left a kitchen full of labelled containers and a recipe book, you can cook immediately. If they left unlabelled jars and no notes, you have to smell and taste everything before you trust it. Well-documented code is the labelled kitchen; undocumented code is the mystery jars.

Common misconceptions to watch for

  • Good programmers write code that only they can understand — in reality, writing code that others can easily read is considered a higher skill than writing clever but obscure code
  • If you did not write the code, you cannot fully understand it — in reality, reading others' code is how most experienced developers learned most of what they know

Key facts in one breath

  • Studies show professional developers spend 60–70% of their coding time reading existing code, not writing new code
  • A docstring in Python is a string literal at the start of a function that describes what it does — accessible via help() or __doc__
  • Code review (reading a colleague's code before it is merged) is a standard industry practice that catches both bugs and security issues
  • Variable names, function names, and comments form the 'narrative' of code — they should make intent clear without needing to read every line

How Dhee Learning teaches this — the 3-stage question loop

Every Dhee Learning session for this concept follows three stages. We share the questions Dhee actually asks, so you can hear what a session sounds like.

Stage 1 — Surface

You find a Colab notebook on GitHub that does almost exactly what you need. What is the first thing you do before running any of it?

Rote answer

"Read it to understand what it does"

Understood

"Check the imports to see what libraries it uses, read the overall structure to understand the flow, look for any code that accesses files, network, or secrets, and assess whether the source is trustworthy — running unknown code blindly is a security risk"

Stage 2 — Reasoning

When you encounter a function in someone else's code that you do not understand, what is your strategy? What would you look at first, second, and third?

Follow-up Dhee may use: What would you do if the function has no name, no docstring, and single-letter variable names? What does that code quality tell you about trusting its output?

Stage 3 — Application

Here is a 20-line function you have never seen. Without running it, write a 3-sentence explanation of what it does, what it expects as input, and what it returns. Then run it on a test case and compare your explanation to the actual output.

Misconception Dhee watches for: Assuming that if code runs without errors, it does what they think it does — without testing it, there is no way to confirm the mental model is correct

Related concepts

Want your child to actually understand this?

Dhee turns this concept into a 15-minute spoken session — asking, listening, and probing — so your child builds the idea themselves.

Frequently asked questions

What is reading other people's code — explained for kids? +

Developers read far more code than they write. Why reading code is its own skill, and how to get good at it. For Class 7.

What's the most common mistake children make about this concept? +

Good programmers write code that only they can understand — in reality, writing code that others can easily read is considered a higher skill than writing clever but obscure code

How does Dhee Learning teach this in a Class 7 session? +

Dhee opens with a question — for example: "You find a Colab notebook on GitHub that does almost exactly what you need. What is the first thing you do before running any of it?" — listens to your child's answer, then probes the reasoning behind it. The session ends when the child can apply the idea to a brand-new situation, not just recall it.