Procedures and Sub-Procedures
What is a Procedure?
Procedure
A is a series of steps or actions that are followed to achieve a specific goal.
In computer science, procedures are often referred to as algorithms.
Example- A recipe is a classic example of a procedure.
- It provides a step-by-step guide to preparing a dish.
- To make a sandwich, you need to:
- Gather bread, butter, and filling.
- Spread butter on the bread.
- Add the filling.
- Place the second slice of bread on top.
- Cut the sandwich in half.
Steps to Identifying a Procedure
NoteWhen you identify a procedure, you are essentially designing an algorithm that can be implemented in a program.
Understand the problem: Before you can identify a suitable procedure, you need to understand the problem fully.
TipAsk yourself:
- What is the goal?
- What constraints are there?
- What resources do I have?
Break down the problem: Divide it into smaller, manageable parts.
ExampleIf you are asked to bake a cake, the smaller parts might include:
- Gathering ingredients
- Mixing the batter
- Baking the cake
- Decorating the cake
Identify the steps: List the specific actions needed to solve each part of the problem.
ExampleFor mixing the batter, the steps might be:
- Crack the eggs into a bowl.
- Add sugar and butter.
- Mix until smooth.
Put the steps in order: Arrange the steps in the correct sequence.
Common Mistake- Arranging in order is crucial because the order can affect the outcome.
- For example, you can't bake the cake before mixing the batter.
Review and refine: go through the procedure to ensure it is complete and efficient.
TipAsk yourself:
- Are there any unnecessary steps?
- Is there a way to simplify the process?