Decomposition is a fundamental computer science skill that is essential for developing students' long-term understanding of how to solve coding problems. This article explores what decomposition is, why it is important, and how to facilitate student learning of decomposition.
What is decomposition?
Decomposition is the process of breaking a complex problem into smaller, more manageable parts. This simplifies the process of creating a coding project by allowing students to solve one component of the problem at a time.
Why is decomposition important?
When students begin to learn to code, they are faced with thinking about language in a new and challenging way. They must shift from communicating in spoken language, which is full of inferences and nuance, to the precise and logical structure that is required in coding. This adjustment is extremely difficult for students and often gets in the way of their success. Decomposition is a critical computer science skill students must gain in order to code successfully, as it allows students to begin with spoken language and refine it until it is something that can be used in a coding project.
Decomposing a problem allows it to be solved in small increments, helping to prevent it from becoming overwhelming to students. When students decompose problems into smaller parts before they begin to code, they can then build each small section of a project and test it to be sure it works as expected, before moving on to the next part. This is much easier than trying to code all of the steps needed to achieve a goal at once, and prevents students from the frustration of becoming lost in a long project when trying to troubleshoot errors.
The process of decomposition also gives students a systematic approach to building a project, eliminating the temptation students may have to guess and check their way to a solution. Guessing and checking is an inefficient way to solve a problem, and it becomes ineffective as students begin to engage with more and more complex coding challenges.
Additionally, decomposing a project allows students to identify patterns in their code, and to build on, modify, and reuse sections of code. This makes both building and troubleshooting projects easier, while providing students with a deeper understanding of the code they are creating, allowing them to use this understanding in future projects.
Finally, decomposition also facilitates collaboration among students as they work together to create robotics projects in groups. A decomposed project recorded in an engineering notebook provides an artifact for students to use when discussing group projects or sharing with other groups.
Facilitating Decomposition
Decomposition occurs when students are in the planning stage, before they ever begin to build out their projects. Students should record their decomposition process in their engineering notebooks and share it with you before they begin to code. For more information about using engineering notebooks with students, see this article.
Provide students with this simple three-step framework for approaching decomposition:
- Identify the main goal of the project by stating the outcome the robot will demonstrate when the project is successful. Record this goal in the engineering notebook.
- Determine the main steps the robot must take in order to achieve the goal. Consider and record the main, or big picture steps the robot will need to complete in order to achieve the goal. Record these high-level steps in the engineering notebook.
-
Break the main steps down into the smallest possible increments of robot behavior. Break each of the main steps down into the smallest behavior the robot can complete. Record these decomposed steps in the engineering notebook.
- Each of the robot behaviors should be able to be matched with one corresponding block or command. If not, the steps can be decomposed further.
In this example, students are decomposing a project to complete a maze in the VEXcode VR Wall Maze + Playground.
Step 1: Identify the main goal of the project. Record the goal in the engineering notebook.
Step 2: Determine the main steps the robot must take to achieve the goal.
- Here, the student has thought through all of the behaviors the robot will need to take to drive from the starting point to the ending point of the maze, and listed them in order in the engineering notebook.
Step 3: Break the main steps into the smallest increments of robot behavior.
- Students can begin to determine the approximate values needed to complete each step. These values will need to be tested and adjusted when building the project in VEXcode.
- Students should check to be sure each decomposed step corresponds directly with one VEXcode block. If not, the step needs to be decomposed further.
Once students have decomposed their project down to the level of individual blocks or commands, they can move from the project planning stage to the implementation stage. They should transfer the main steps determined in step 2 into Comments, and then add the corresponding blocks or commands for each fully decomposed behavior from step 3 to each of those Comments in order to build their projects.
Students should build their projects one decomposed step at a time, testing each behavior (or logically grouped set of behaviors) before moving on to the next one. It is at this stage where students will need to use the resources they have to determine the correct parameter values. For example, in the VEXcode VR example above, distance values were determined using the knowledge that each maze square is 300mm across. The method for determining values will vary depending on the circumstance, but it will always be necessary to test and adjust values during the process of creating a coding project.
Supporting Students as they Learn Decomposition
Before students begin to work on a challenge from a STEM Lab, or other VEXcode project, take time to work through the decomposition yourself so you are ready to answer questions students may have. Encourage students to show you the decomposed plan for their project before they start to code, so you can reinforce the process of decomposition and check to be sure they have broken the task down into the smallest possible robot behaviors. Remind students that they should be able to identify a block or command that corresponds to each behavior.
- If students are having difficulty envisioning the main, or big picture steps that the robot needs to take to accomplish the goal of the project, encourage them to:
- Draw the path the robot needs to take to accomplish the goal.
- Act out the steps the robot needs to take to accomplish the goal.
- Talk through the steps the robot needs to take to accomplish the goal.
- If students are struggling to determine if their steps have been decomposed down to the individual block or command level, ask them:
- How many blocks or commands would it take for the robot to complete that behavior?
- Can the robot complete that step using just one block or command?
- How can you decompose that behavior into even smaller robot actions?
Supporting your students as they learn to decompose will ensure they have a solid foundation for future problem solving in computer science.
Do you have more questions about facilitating students' learning of decomposition in your classroom? Ask them in the PD+ Community, or schedule a 1-on-1 Session to talk with a VEX Expert.