Send Close Add comments: (status displays here)
Got it!  This site "creationpie.com" uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.  Note: This appears on each machine/browser from which this site is accessed.
Top-down vs. bottom-up
by RS  admin@creationpie.com : 1024 x 640


1. Top-down vs. bottom-up
The use of top-down backward-chaining thinking and logic in problem solving is essential to computer science thinking. Most other people use bottom-up forward-chaining thinking and logic and problem solving which is, in most cases, not the best way. The most common problems with this way of thinking is that the goal may not be clear, one may not get to the goal, one may deviate from the goal, and one may do extra work in trying to get to the goal.

2. Aristotle: Top down reasoning
English: It is just as the Pythagoreans say, the whole world and all things in it are summed up in the number three; for end, middle and beginning give the number of the whole, and their number is the triad. (Loeb#338)
Greek: Καθάπερ γάρ φασι καὶ οἱ Πυθαγόρειοι, τὸ πᾶν καὶ τὰ πάντα τοῖς τρισὶν ὥρισται· τελευτὴ γὰρ καὶ μέσον καὶ ἀρχὴ τὸν ἀριθμὸν ἔχει τὸν τοῦ παντός, ταῦτα δὲ τὸν τῆς τριάδος. Aristotle: On the Heavens [268a]
Notice how Aristotle says Aristotle says the "everything" while the translation says the "whole world". Some in modern Greek makes a play on words with "everything" and a panda (animal) since the words are spelled and pronounced the same.
Information sign More: Everything and all things: But wait, there's more
Information sign More: Aristotle

3. Stair analogy
A stair analogy can be used to help understand top-down design and bottom-up implementation.

Stepwise refinement - numbered
Implementation: Design: When it works, top-down tends to be better.
It is said that problem solving is best done in a top-down method.

4. Top-down vs. bottom-up
A top-down method goes from general to specific. It is goal-oriented.

5. Top-down vs. bottom-up
A bottom-up method goes from specific to general, working towards the goal.

Question: Why is it difficult for beginning students to understand top-down and bottom-up methods?

6. Top-down programming
You cannot teach beginners top-down programming, because they don't know which end is up (Tony Hoare). Question to famous computer scientist Tony Hoare (British computer scientist) . Why is it so hard to teach (or require) beginning programmers top-down programming?

7. Top-down programming
Arrow illusion verticalYou cannot teach beginners top-down programming, because they don't know which end is up. Tony Hoare.

Problem-solving methodology:
Compare to Waterfall method, SDLC (Systems Development Life Cycle), etc.
Information sign More: Tony Hoare
Let us look at solving a simple problem. How would you give instructions for someone in York to get to Elizabethtown via Lancaster? You are in York and want to go to Lancaster.

8. Lancaster and York

9. Getting from A to C
How would you give instructions for someone in York to get to Elizabethtown via Lancaster? Getting from A to CNote: You are in York and want to go to Elizabethtown.

10. Start to stop way
That is: (start) A to B to C (destination)
That is: A then B then C (bottom-up, forward chaining)

11. Stop to start way
That is: (destination) C from B from A (start)
That is: C if B if A. (top-down, backward-chaining)

How do you like this way of giving directions?

12. Comparison
Getting from A to CWhich way of giving directions is more clear?

13. Methods
Both methods provide the same solution. Which method is more comfortable to you?

14. Implementation
Programming languages example: top-down parsing and bottom-up parsing of input.

15. Abstraction
Thinking in a top-down backward-chaining way can be very helpful for solving problems in general and in computer science in particular.

16. Bottom-up trade-offs
The bottom-up, forward chaining method, in general: Example: Getting a college degree.

17. Methods and trade-offs
 ▶ 
 + 
 - 
 1 What goal? 
 2 Wrong goal 
 3 Give up 
 4 Distracted 

The top-down, backward-chaining method, in general, insures a correct solution (we will get there) that is direct-to-goal. It avoids extra work.

A bottom-up, forward-chaining method, in general, is indirect-to-goal and may involve extra work and may not get to the goal.

Of course, this assumes that you have a goal and are working towards that goal.





18. Goals
Book cover: Yogi BerraYou've got to be very careful if you don't know where you are going, because you might not get there. Yogi Berra (American professional baseball player and manager)
Information sign More: Yogi Berra

19. Induction and deduction



20. Top-down: when it works
When it works, top down avoids extra work and gets you to where you want to be. When does the top-down method not work well?

21. Induction
A good way to recognize a top-down design in data is to use a bottom-up inductive recognition process and gradually piece together parts. At some point, one sees the pattern and can move to the top-down deductive pattern.

This is what is done with a bottom-up parsing method. It recognizes a language and pieces together the parse tree in a bottoms-up manner. One people recognize the top-down patterns, they may develop rules that actually inhibit learning.

Here are some problems that work better in a bottom-up manner than a top-down manner.

22. Language learning
Which is a better way to learn a language? How well does a normal child learn a language using the bottom-up process by the time they are six years old?

How well does an adult learn a language using the top-down process after, say, six years of study as part of an overall curriculum that includes other subjects?

23. Language translation

24. Alan Kay and teaching children to program
How might one go about writing a program to draw a circle.

25. Problem solution types
There are three "E" parts to solutions where each step depends on the previous steps. In general problem solving, one searches for a solution or that a solution exists. Once this search establishes the existence of a solution, one may seek an effective solution. Later, one may search for the most efficient solution, according to some set of efficiency criteria. An example is that of prime numbers.

26. Solution examples
The world's security of information systems is based on the assumption that there is no efficient way to determine the prime factors of a large composite number.

27. End of page

by RS  admin@creationpie.com : 1024 x 640