Computer ScienceChapter 2: Computational Thinking & Algorithms
2.1.3 Planning and Developing a Computational Artifact
Planning and developing a computational artifact
Explanation level
Introduction
Once the basic idea of computational artifacts is clear, the next step is to understand how to plan and develop an artifact from scratch. This involves a systematic process that starts from defining the problem and ends with testing the algorithm. Following these steps ensures that the solution is complete, correct, and ready for implementation.
Definition
Planning and developing a computational artifact refers to the systematic process of defining a problem, identifying inputs and outputs, designing the solution logic, developing the steps, and testing the algorithm before implementation.
In simple words, it is the step-by-step method used to create a computational solution.
Main Idea
The planning and development of a computational artifact follows a five-step process:
- Define the problem
- List the inputs and outputs
- Plan (outline logic, choose data structures, choose control structures)
- Development
- Test the algorithm
Each step builds on the previous one to create a complete, working solution.
Core Concept
The core concept is that a computational artifact cannot be created randomly. It requires careful planning, clear definition of what goes in and what comes out, logical design, step-by-step development, and thorough testing.
Detailed Explanation
a. Define the Problem
State the problem you are trying to solve in clear and concise terms. This is the foundation of the entire process. If the problem is not clearly defined, the solution will not be correct.
Example: For the Jeroo flower picking problem, the problem definition is: A Jeroo is at position (0,0) facing East. A flower is at (3,0). The Jeroo must pick the flower and plant it at (3,2), then move one hop East and stop.
b. List the Inputs and Outputs
List the inputs (information needed to solve the problem) and the expected outputs (what the algorithm will produce as a result).
- Inputs: Jeroo starts at (0,0), flower current location at (3,0)
- Outputs: Flower new location at (3,2), Jeroo stops one hop East
c. Plan
The planning step has three sub-parts:
i) Outline the Logic
Break down the problem into smaller problems and consider how to solve each one.
- Pick flower
- Put flower
- Move East
ii) Choose Data Structures
A data structure is a storage to save and organize the data. We have different types of data structures such as array, stack, queue, etc. The choice of data structures is determined by considering the merits and drawbacks associated with each specific data structure.
Example: For the Jeroo problem, the position (x, y) can be stored as two integer variables or as a tuple.
iii) Choose Control Structures
Control structures enable us to determine the order of program execution. The sequential order of execution is disturbed in two aspects:
- Skip some program statements: This is usually done with the help of conditional statements (if-else).
- Repeat one or more program statements: This is done by using loops (for, while).
Those control structures are selected that are most appropriate for our solution.
Example: For the Jeroo problem, a sequence of steps (hop, turn, pick, plant) is used. No loops or conditions are needed because the number of steps is fixed.
d. Development
Describe the steps needed to convert or manipulate the inputs to produce the outputs. Start at a high level first and keep refining the steps until they are effectively computable operations. Keep the process simplified and remember that the number of steps should be finite.
Example — Jeroo Problem Development:
- Pick Flower
- Hop 3 times
- Take the flower
- Put Flower
- Turn right
- Hop 2 times
- Plant the flower
- Move East
- Turn left
- Hop 1 time
e. Test the Algorithm
Choose data sets and verify that your algorithm works correctly. Testing helps identify logical errors before implementation.
Example: Trace through the Jeroo algorithm step by step to verify that the Jeroo reaches the flower, picks it, plants it at the correct location, and stops at the required position.
Refinement Questions
After the development of the algorithm, try to refine it by asking yourself the following questions:
1. Does the developed algorithm solve some specific problem or could it be generalized?
Example: The algorithm that finds the area of a circle having radius of 3 meters (formula A = πr²) solves a specific problem, but it could be made generalized by using the formula A = πr².
2. Can the developed algorithm be made simplified?
Example: The formula for calculating perimeter of square is: Perimeter of square = side + side + side + side
A simple formula would be: Perimeter of square = 4 × side
Intermediate Level
Why Each Step Matters
| Step | Why It Matters |
|---|---|
| Define the problem | Without a clear problem, the solution will be wrong |
| List inputs/outputs | Helps understand what data is needed and what result is expected |
| Plan logic | Breaks complex problems into manageable parts |
| Choose data structures | Determines how data will be stored and accessed |
| Choose control structures | Determines how the program will flow |
| Development | Creates the actual step-by-step solution |
| Testing | Finds errors before implementation |
Data Structures — A Closer Look
A data structure is a storage to save and organize the data. Common data structures include:
- Array — a collection of similar items
- Stack — last-in, first-out
- Queue — first-in, first-out
- List — ordered collection
- Tuple — immutable ordered collection
The choice of data structure depends on:
- What kind of data is being stored
- How the data will be accessed
- Whether the data needs to be modified
- Performance requirements
Control Structures — A Closer Look
Control structures determine the order of program execution:
- Sequential — statements execute one after another
- Conditional (if-else) — some statements are skipped based on a condition
- Loops (for, while) — some statements are repeated
Example — When to use which:
- If you need to check if a number is even or odd → Conditional
- If you need to print numbers 1 to 10 → Loop
- If you need to swap two variables → Sequential
Formula / Mathematical Form
Not applicable for this topic.
Solved Example
Example — Planning and Developing a Simple Algorithm
Problem: Find the sum of first 10 positive numbers.
Step 1: Define the Problem Calculate the sum of numbers from 1 to 10.
Step 2: List Inputs and Outputs
- Inputs: None (the range is fixed: 1 to 10)
- Outputs: Sum of numbers 1 to 10
Step 3: Plan
- Outline logic: Start with sum = 0, add each number from 1 to 10 one by one
- Data structures: One variable (sum)
- Control structures: Loop (repeat 10 times)
Step 4: Development
- Set sum = 0
- For i from 1 to 10:
- sum = sum + i
- Print sum
Step 5: Test
- sum = 0
- i = 1: sum = 1
- i = 2: sum = 3
- i = 3: sum = 6
- i = 4: sum = 10
- i = 5: sum = 15
- i = 6: sum = 21
- i = 7: sum = 28
- i = 8: sum = 36
- i = 9: sum = 45
- i = 10: sum = 55
Output: 55 (correct)
Important Points
- - Planning and developing a computational artifact follows a five-step process: Define problem, List IO, Plan, Development, Test.
- - The problem must be clearly defined before proceeding.
- - Inputs are what the algorithm needs; outputs are what it produces.
- - Planning includes outlining logic, choosing data structures, and choosing control structures.
- - Data structures store and organize data (array, stack, queue, etc.).
- - Control structures determine program flow (sequential, conditional, loops).
- - Development creates step-by-step instructions.
- - Testing verifies the algorithm works correctly.
- - Refinement questions help generalize and simplify the algorithm.
- - The number of steps in an algorithm should be finite.
Remember
- - **Five steps:** Define → List IO → Plan → Develop → Test.
- - Data structures: Array, Stack, Queue, etc. — choice depends on data and access needs.
- - Control structures: Sequential, Conditional (if-else), Loops (for, while).
- - Development: Start high-level, refine until computable.
- - Testing: Choose data sets and verify.
- - Refinement: Generalize and simplify.
- - Finite steps — an algorithm must end.
Common Mistakes
- - Skipping problem definition: Without a clear problem, the solution will be wrong.
- - Not listing inputs/outputs: Leads to incomplete understanding of what the algorithm needs and produces.
- - Choosing wrong data structure: Can make the algorithm inefficient or difficult to implement.
- - Forgetting control structures: Some problems require loops or conditions; ignoring them leads to incorrect solutions.
- - Not testing the algorithm: Logical errors remain undetected until implementation.
- - Making the algorithm too specific: Not generalizing when possible limits reusability.
- - Not simplifying: Overcomplicated algorithms are harder to understand and maintain.
- - Infinite steps: An algorithm must have a finite number of steps.
Quick Revision
Planning and developing a computational artifact follows a five-step process:
- Define the problem — state the problem clearly
- List inputs and outputs — what goes in, what comes out
- Plan — outline logic, choose data structures, choose control structures
- Development — describe steps to convert inputs to outputs
- Test the algorithm — verify correctness with data sets
- Can the algorithm be generalized?
- Can it be simplified?
Data structures store and organize data (array, stack, queue, etc.). Control structures determine program flow (sequential, conditional, loops). The number of steps should be finite.
60-Second Revision
- **Five Steps:** Define → List IO → Plan → Develop → Test.
- Plan: Outline logic, choose data structures, choose control structures.
- Data Structures: Array, Stack, Queue, etc.
- Control Structures: Sequential, Conditional, Loops.
- Development: Refine until computable, finite steps.
- Refinement: Generalize and simplify.
- Warning: Never skip testing — logical errors must be found before implementation.
Did you understand this topic?
Your answer is saved with your learning record. It does not mark the topic as mastered.
Quick revision
Revision Zone
Review the key facts, formulas and checks before you move on.2.1.3 Planning and Developing a Computational Artifact
Sticky Notes · Quick Revision
Key Point 1
- **Five Steps:** Define → List IO → Plan → Develop → Test.
Key Point 2
- Data Structures: Store and organize data (array, stack, queue).
Key Point 3
- Control Structures: Sequential, Conditional, Loops.
Key Point 4
- Development: High-level → refine → computable steps.
Key Point 5
- Testing: Choose data sets, verify correctness.
Key Point 6
- Refinement: Generalize and simplify.
Key Point 7
- Finite steps — algorithm must end.
Key Point 8
- Jeroo Example: Pick flower → move → plant → move East.
Same supplied content as this Notes page (shared canonical source).