Two ways to design complex system: Top-down vs Bottom-up

1.6k views Asked by At

I have a complex system to design. I have two ways:

  1. Top-down: I will design many interfaces and contracts. Afterwords, I will implement these interfaces, and write a prototype to verify the design.

  2. Bottom-up: I will write code to make the system run. Afterwords, I will extract interfaces and contracts from solid code. The distilled interfaces and contracts is my design. It's rule "make it run, make it right".

What is better way? From my opinion, I will choose Bottom-up. Because Top-down is very difficult, no one can design many interfaces at high abstract level,at least it's hard for me. When I write solid implementation to verify the initial design, there are many unreasonable things which force me to re-design from scratch. While I use Bottom-up, I feel quite "safe", it can run at least.

5

There are 5 answers

0
DVK On BEST ANSWER

As others have said, it's usually a mix. On a more practical level, the following approach usually helps:

  • Start by going ABSTRACT Top-Down. Namely, break the system/design into logical components to solve tasks. But don't design precise finalized interfaces for those components. Proceed recursively till some components you arrive at are of "implementation-possible" size (e.g. are the size of a single function/method/class)

  • Then, go through the resultant component list Bottom-Up, and start designing first draft of interfaces/contracts.

  • Then, go through the resultant component list Bottom-Up, and start implementing them. This will allow you to:

    • Have a working and testable code immediately (no need to wait for underlying components to be implemented to test)

    • You can synthesize the final version of interfaces/contracts for higher level components based on the needs of the already-completed lower level components.

0
maks On

In my opinion, top-down design is more natural than bottom-up one. E.g.: when you are designing a system, primarly you define its functionality(design interfaces and contracts), then you specify the entities of the system, implement relations among them and so on... Certainly, top-down design is more difficult than bottom-up one, and it requires experienced developers.

0
Preet Sangha On

Except in most trivial designs nothing is ever this simplistic. I find that most designs require a mixture of both methodologies to refine.

0
Lorenz On

I personally also prefer Bottom up - first because you always forget something when doing top-down and then have to fix that and second because at least in my case I get lots of good ideas for the complete system while designing the single components from bottom.

Greetings, Lorenz

0
frm On

In the real world is nearly impossibile to use these simplistic methodologies to design systems. You usally have to use both of them in multiple iterations.

But this is a simplistic answer, too.