Skip to main content

Featured

Space Explorers Book 7: Answers and Explanations

Memunic Space Explorers › Book 7: Memoon and the Search for Another Home › Answers and Explanations Answers and Explanations Habitable means life could live there; inhabited means life does live there. A world can be habitable and empty, as an unoccupied flat has a roof and water but nobody in it. The Moon has almost no air, so water would boil or freeze, and its gravity is only about one-sixth of Earth’s, too weak to keep air. Accept also: no greenhouse blanket, so it swings between very hot and very cold. Venus. It matches Earth in size and roughly in mass, but its thick carbon dioxide air traps heat, making it hot and crushing. “Twin” is only true for size and weight. A dip of 1 per cent means (planet width divided by star width) squared is 0.01, so the ratio is 0.1: the planet is about a tenth as wide as the star. Repeats at the same gap show the planet is going round the star in 12 days, and rule out a one-time event such as a passing object. A planet shines only by reflected l...

Byte by Byte Book 5: Chapter 1 – Computational Thinking and Decomposition

Byte by Byte › Book 5: Games, Spreadsheets and Networks › Chapter 1: Computational Thinking and Decomposition

Chapter 1: Computational Thinking and Decomposition

You will learn: the four parts of computational thinking (decomposition, pattern recognition, abstraction and algorithms), how to break a big problem into a tree of smaller ones, and how to use these skills to plan a game.

🌟 The Adventure

The Queen's announcement rolled across Memunic World like thunder. "In three weeks we will hold the first Memunic Games! Every village will compete in sport, and every village will build an arcade game for the Grand Arcade. The Games will be watched by everyone, scored fairly, and kept safe. Simbha, our Guardian, will be in charge."

The crowd cheered. Simbha bowed, and the Queen hung a bronze medallion round his neck: Guardian of the Games.

An hour later Memoon found him in the palace garden, surrounded by scrolls. His mane was sticking out in every direction.

"Memoon," he groaned. "There are tracks to build, games to make, scores to keep, messages to send to twelve villages, gates to guard, judges to choose... I don't know where to start." He gave a small, unhappy roar. Noodles hid behind a bush.

Memoon sat down beside him, opened her notebook and drew one big box in the middle of a fresh page. Inside she wrote: Run the Memunic Games.

"You can't do this," she said. Simbha looked hurt. "Nobody can," she went on. "Not in one go. But you can do a lot of small things. Programmers have a name for what we're about to do. It's called decomposition."

💡 Learn With Memoon

What is computational thinking? Computational thinking is a way of solving problems so that a person, a computer, or both can carry out the solution. It is not about computers only. Engineers, doctors, chefs and event planners use it every day. It has four parts, sometimes called the four pillars.

PillarWhat it meansEveryday example
DecompositionBreaking a big problem into smaller parts that are easier to solveCleaning your room becomes: clothes, books, desk, floor
Pattern recognitionSpotting things that are the same or similar, so you can reuse a solutionEvery maths word problem about speed uses distance ÷ time
AbstractionKeeping the details that matter and ignoring the ones that don'tA metro map shows stations and lines, not every street and tree
AlgorithmsWriting clear step-by-step instructions to solve the problemA recipe; the steps to log in to a computer

You met algorithms in Book 2 and wrote real ones in Scratch in Book 4. This chapter adds the other three.

Decomposition. To decompose a problem, ask: what smaller jobs would have to be done for this to be finished? Write each one down. Then do the same to each smaller job. Keep going until every part is small enough that you know exactly how to do it, or one person can do it in one sitting.

The result looks like an upside-down tree, so it is called a decomposition tree. Here is Memoon's first attempt for the Games:

  • Run the Memunic Games
  • Sport
  • Build the running track
  • Make a timetable of races
  • Choose fair judges
  • Grand Arcade
  • Help villages build games
  • Set up screens in the arcade hall
  • Scores
  • Record every result
  • Work out totals and winners
  • Show the results
  • Communication
  • Send results between villages
  • Send invitations
  • Safety
  • Guard the gates
  • Protect everyone from tricksters

Notice three things. First, the top box is the whole problem. Second, each level is more detailed than the one above. Third, the bottom boxes, called the leaves, are jobs someone can actually start today.

How do you know you have decomposed enough? A part is small enough when you can answer yes to one of these: Do I know exactly how to do this? Could one person or one short program do it? Could I write it as a few steps? If not, break it down again.

Decomposing a game. Programmers decompose before they code. Take a simple game called Catch the Fruit: fruit falls from the top of the screen, and you move a basket left and right to catch it.

  • Catch the Fruit
  • The basket: move left and right with the arrow keys; stay on screen
  • The fruit: start at a random place at the top; fall down; go back to the top when it is caught or reaches the bottom
  • Catching: notice when fruit touches the basket
  • Score: start at 0; add 1 for each catch
  • Ending: stop after 60 seconds; show the final score

Each leaf becomes one small script. That is exactly how you will build games in this book.

Pattern recognition. Once a problem is broken up, look for parts that are alike. In Catch the Fruit, an apple, a banana and a mango all behave the same way: fall, get caught, reset. Solve it once, then reuse the solution. In Chapter 5 you will learn a Scratch tool called clones that does exactly this. Patterns also show up between problems: almost every game has a player, something to collect or avoid, a score and an ending.

Abstraction. Abstraction means hiding detail that does not matter for this problem. A metro map is a famous example. It shows stations, lines and where you change trains, but the bends of the track, the buildings above and the real distances are left out. For a passenger, those details would only get in the way.

In a game, the basket does not need a real weight or a real material. It only needs a position, a size and a way to move. The fruit does not need vitamins. Programmers ask: what does my program need to know about this thing? and ignore the rest. When you choose which details to keep, you are abstracting.

Putting the four together. Computational thinking usually happens in this order:

  1. Decompose the problem into parts.
  2. Recognise patterns among the parts, and with problems you have solved before.
  3. Abstract: decide which details each part really needs.
  4. Write an algorithm for each part, then turn it into code.

Order and dependencies. Some parts must be done before others. You cannot show the results before you record them. You cannot test catching before the fruit falls. A part that has to wait for another part depends on it. When you plan, number your leaves in an order that respects these dependencies.

💡 Memoon’s tip: If a problem feels scary, it is usually because you are looking at the top box. Look at the leaves instead.

Illustration from Byte by Byte Book 5: Chapter 1 – Computational Thinking and Decomposition

✍️ Try It Yourself

Activity 1: Decompose a class picnic. In your notebook, draw a decomposition tree for Organise a class picnic. Use at least three levels. Your second level might include food, place, travel, games and permission. Break each into at least two leaves. Then:

  1. Circle any leaf you still don't know how to do, and break it down one more level.
  2. Number the leaves in the order they must happen. Which leaves depend on others?
  3. Put a star next to leaves that could be done at the same time by different people.

Activity 2: Decompose a real game. Open scratch.mit.edu and click Explore. Choose any simple game and play it for two minutes. Do not look inside yet. In your notebook, decompose it like Catch the Fruit above: the player, the other objects, how they interact, the score and the ending. Then click See Inside and check: did each part of your tree become a script or a group of scripts?

Activity 3: Pattern hunt. Think of three games you know (on a computer, a phone or a board). For each one, write: Who is the player? What do you collect or avoid? How do you score? How does it end? Underline anything that is the same in all three. That shared shape is a pattern you can reuse.

Unplugged: The abstraction map. Draw a map of your route from home to school (or to a park) that a new friend could follow. You may use only ten labels. Which details did you keep? Which did you leave out? Swap maps with someone and see if they can follow yours.

🎉 Memoon Solves It

By sunset the scrolls were gone. In their place was one large tree pinned to a board in the palace garden. Each branch had a friend's name beside it.

"Kachui, you're good with order and timetables: Sport is yours," said Memoon. "Beautine, you can help the villages with the Grand Arcade. Nimo, you're good with numbers: Scores. Bleep, Communication. And Simbha..." She tapped the last branch. "Safety. You're the Guardian. That's the part only you can do."

Simbha studied the tree. "Every leaf is something I can start tomorrow," he said slowly. His mane seemed to settle by itself.

"And look," said Memoon, pointing. "The Arcade games, the Scores and the Sport results all need the same thing: something that remembers numbers and changes them. That's a pattern. If we learn it once, we can use it everywhere."

"What is it called?" asked Simbha.

Memoon wrote one word at the top of a new page: Variables.

❓ Check Your Knowledge

  1. Name the four pillars of computational thinking.
  2. What is decomposition? Give an example from your own life.
  3. In a decomposition tree, what are the bottom boxes called, and what should be true about them?
  4. Match each pillar to its example: (a) a metro map; (b) a recipe; (c) noticing that apples, bananas and mangoes all fall the same way in a game; (d) splitting clean my room into four jobs.
  5. True or false: computational thinking is only useful for people who write code.
  6. What does it mean for one part of a plan to depend on another? Give an example from Catch the Fruit.
  7. Fill in the blank: abstraction means keeping the details that ________ and ignoring the ones that don't.
  8. Why do programmers decompose a game before they start coding?
  9. Challenge: Draw a three-level decomposition tree for Make a two-minute animated birthday card in Scratch. Mark one pattern you notice and one detail you would abstract away.

📚 Word Bank

  • Computational thinking: a way of solving problems so that a person or a computer can carry out the solution.
  • Decomposition: breaking a big problem into smaller, easier parts.
  • Decomposition tree: a diagram showing a problem broken into smaller and smaller parts.
  • Leaf: a bottom box in a decomposition tree; a job small enough to start.
  • Pattern recognition: spotting similarities so a solution can be reused.
  • Abstraction: keeping important details and hiding unimportant ones.
  • Algorithm: a clear, step-by-step set of instructions to solve a problem.
  • Dependency: when one task must wait for another to be finished first.

Keep learning with Byte by Byte

Explore Book 5: Games, Spreadsheets and Networks. Find the ebook, purchase details and teaching slides on MemuniCity.

Watch this chapter on YouTube

Comments

Popular posts from this blog

CA-7 Job Status and Failure Reason Codes

Here are the various status codes that You may see for jobs in the Queue or Logs in CA-7. R-C0002 R-C0003 R-C0099 R-C0255 R-JCLER A-U0002 A-U0004 A-U0015 A-U0043 A-U4095 A-SOC7 A-U4000 Reason Code/Job Status Code explanation: The indication of the job's current disposition. Values and their meanings are: A-Snnnn-- The job has failed with a system abend. A-Unnnn --The job has failed with a user abend. C-Cnnnn --The job has completed successfully and is going through completion processing. E-ARFATT-- An error occurred during the attempt to attach ARF definitions. This can result if the ARFSET specified is not defined. A diagnostic message may have been written to the CA-7 log, the OS console, or to the trailer queue for the job (in which case it can be displayed using LQ,JOB=x,LIST=ALL). E-ARFERR ---The job encountered an error in the ARF processing. Do a LARFQ command for the job to get more specific information. E-SEGERR --The job has been requeued...

Whistling Winds and Waterfalls: 4 Days of Magic in Shillong

Nestled in the clouds, where the scent of pine trees mingles with the rhythm of waterfalls and the tunes of local guitar-strumming youth—Shillong is more than a place. It’s a vibe. If you’ve got 3 nights and 4 days, you’ve got just enough time to fall in love. Here’s how to make the most of it—food, fun, fog and fantastic views included. Day 1: Shillong, We’re Coming for You! You land in Guwahati, barely out of the airport when the hills start calling. You hop into your cab, Spotify on, windows down, and the three-hour ride to Shillong begins. Just when you think it can’t get better, you stop at Umiam Lake —a lake so calm, it looks like someone ironed the water. By evening, you’re sipping hot chai in Laitumkhrah, maybe nibbling on spicy momos or pork jadoh from a roadside stall. You’re checked into your charming hotel ( Tripura Castle if you fancy old-world royalty, Ri Kynjai if you’re into lakeside poetry). The breeze whispers secrets of waterfalls and pine forests. Sleep well, drea...

Installing and Configuring Hadoop on Ubuntu as a Pseudo Distributed Single Node Cluster

Briefly what is psuedo-distributed single node Hadoop cluster: It is a Hadoop distributed cluster having Single Node. All the five daemons (NN,DN,JT,TT,SNN) are running as individual JVM (java process) instances. We will get all distributed features of Hadoop. This mode is used to develop, test, and staging (before production) Map Reduce programs quickly. It writes all the system, daemon and user logs to different files on the cluster To install Hadoop in this mode, we have to modify the hadoop-env.sh, core-site.xml, hdfs-site.xml, mapred-site.xml. hadoop-env.sh contains all the Environment variables which are required for running Hadoop. All the default values are fine, Only we have to modify the JAVA_HOME=“The location of Java Home Directory” Core-site.xml contains all the cluster specific information like io, temp directory, sorting, file system uri etc. Hdfs-site.xml contains all the parameters which are specific to HDFS like name node directory, data node directory...