Uploaded by Roqeeb Adegbola

Stepwise Refinement

advertisement
Stepwise
Refinement
What is Stepwise Refinement
1.
2.
3.
The process of breaking down a
programming problem into a series
of steps.
Once done break them down into a
series of smaller steps.
Keep on going until you have
described the problem in such a
level of detail that you can code a
solution to the problem.
1.1.1
1.1.2
Problem
Problem
Step 1
1.1
1.2.1
1.2
1.2.2
Step 2
2.1
1.2.3
2.1
2.2
2.2.1
2.2.2
Step 3
3.1
3.1.1
3.2
3.1.2
3.2.1
3.2.2
Example: Make a cup of tea
Boil The Water
Prepare the
cups
Brew the tea
Serve the tea
Example: Make a cup of tea
Boil The Water
Fill the kettle
Turn on the
kettle
Wait for water
to boil
Fill the kettle
Check to
see if has
enough
water
If not take
to the tap
Turn on
the tap
Wait until
kettle is
full
Turn off
the tap
Return to
the socket
Practice Activity: Going Food Shopping
Use Stepwise Refinement to break down the
process of going food shopping into a series
of steps.
Keep going down through levels of detail until
you would be able to write a ‘food shopping
algorithm’.
Download