Definition. Top-down problem solving
[comp1110-0M]
Definition. Top-down problem solving
[comp1110-0M]When employing top-down problem solving techniques, we assume we already have working implementations of functions to compute results for sub-problems, and use them to solve our main problem. Then, after we have implemented the main problem, we then tackle each sub-problem one by one. Sometimes it helps to apply this recursively: sub-problems get broken up into sub-sub-problems and so on.
By contrast, bottom-up problem solving means we construct functions that we are likely to need, and only afterwards combine them to produce a solution to our problem. While this has the advantage of being easier to test, as we will have runnable code at every stage, it also carries the risk that we will waste effort designing, writing and testing functions that we do not actually need.