# Computer ScienceStepwise Refinement

Another approach to breaking a large problem into smaller parts. It involves identifying the major steps involved in solving the problem. Each of these steps is then divided into the substeps. If necessary, each substep is divided into subsubsteps and so on...

Suppose that our problem is to Do The Weekly Shopping. We could divide the task into 3 major steps,

• Prepare A Shopping List
• Do The Shopping
• Put The Shopping Away

Prepare List can be broken down into the following substeps,

• Check Cupboards
• Look In Fridge
• Write down what is needed

Do The Shopping can be subdivided into,

• Drive to the shops
• Select items
• Pay for items

Put Shopping Away is subdivided into,

• Unpack shopping
• Put some food in fridge
• Put some food in cupboard

The whole process can be represented in a Structure Table. The numbering and indentation are essential features of the structure table. Numbering sometimes begins at 1.

```0 Do The Weekly Shopping    0.1 Prepare List       0.1.1 Check Cupboards       0.1.2 Check Fridge       0.1.3 Write Down What Is Needed    0.2 Do Shopping       0.2.1 Drive To Shops       0.2.2 Select Items       0.2.3 Pay For Items    0.3 Put Shopping Away       0.3.1 Unpack Shopping       0.3.2 Put Some Items In Fridge       0.3.3 Put Some Items In Cupboards```

The indentation and numbering help us to interpret the table. The greater the indentation, the more detailed the step. Be aware that not all problems will break down into groups of 3 subgoals, each with 3 subgoals - this is just an example. A more complex problem may require several levels of indentation as some subgoals are more complex than others.