Skip to main content

Difference between Top-down and Bottom-up Approach in Programming

Here you will learn about difference between top-down and bottom-up approach.

Today we are going to have a comparative study of the two approaches being used in field of structured and object oriented programming. We shall start with a brief understanding of the both followed by comparison and conclusion.

Difference between Top-down and Bottom-up Approach in Programming

Image Source

When talking in terms of computer science and programming, the algorithms we use to solve complex problems in a systematic and controlled way are designed on the basis of two approaches that is Top-down and Bottom-up approach. The ideology behind top-down approach is, a bigger problem is divided into some smaller sub-problems called modules, these modules are then solved individually and then integrated together to get the complete solution to the problem. In bottom-up approach on the other hand, the process starts with elementary modules and then combining together to get the desired result. Let us now quickly see in brief what these two approaches has to offer, how they differ from each other and what are the similarities.

Top-Down Approach

The basic idea in top-down approach is to break a complex algorithm or a problem into smaller segments called modules, this process is also called as modularization. The modules are further decomposed until there is no space left for breaking the modules without hampering the originality. The uniqueness of the problem must be retained and preserved. The decomposition of the modules is restricted after achieving a certain level of modularity. The top-down way of solving a program is step-by-step process of breaking down the problem into chunks for organising and solving the sole problem. The C- programming language uses the top-down approach of solving a problem in which the flow of control is in the downward direction.

Bottom-Up Approach

As the name suggests, this method of solving a problem works exactly opposite of how the top-down approach works. In this approach we start working from the most basic level of problem solving and moving up in conjugation of several parts of the solution to achieve required results. The most fundamental units, modules and sub-modules are designed and solved individually, these units are then integrated together to get a more concrete base to problem solving.

This bottom-up approach works in different phases or layers. Each module designed is tested at fundamental level that means unit testing is done before the integration of the individual modules to get solution. Unit testing is accomplished using low-level functions, that is another topic we will talk about later.

Let us now see a comparative study of both the strategies and try to understand what are common and odds among them.

Difference between Top-down and Bottom-up Approach

Top-Down Approach Bottom-Up Approach
Divides a problem into smaller units and then solve it. Starts from solving small modules and adding them up together.
This approach contains redundant information. Redundancy can easily be eliminated.
A well-established communication is not required. Communication among steps is mandatory.
The individual modules are thoroughly analysed. Works on the concept of data-hiding and encapsulation.
Structured programming languages such as C uses top-down approach. OOP languages like C++ and Java, etc. uses bottom-up mechanism.
Relation among modules is not always required. The modules must be related for better communication and work flow.
Primarily used in code implementation, test case generation, debugging and module documentation. Finds use primarily in testing.

Conclusion

After having a sound discussion on this we all should now have got a clear understanding of the two approaches. The top-down approach is the conventional approach in which decomposition of higher level system into lower level system takes place respectively. Talking about the bottom-up mechanism for algorithm designing, starting from designing lower abstraction modules and then integrating them to higher level provides better efficiency.

We have seen the modules in top-down approach aren’t connected in a manner so that they can communicate well, so giving rise to redundancies, whereas in the later case the redundancies are omitted to large extent. The feature of information hiding and reusability provided by bottom-up approach makes this mechanism even more popular.

Comment below if you have doubts regarding difference between Top-down and Bottom-up approach.

The post Difference between Top-down and Bottom-up Approach in Programming appeared first on The Crazy Programmer.



from The Crazy Programmer https://www.thecrazyprogrammer.com/2018/10/difference-between-top-down-and-bottom-up-approach.html

Comments

Popular posts from this blog

dotnet sdk list and dotnet sdk latest

Can someone make .NET Core better with a simple global command? Fanie Reynders did and he did it in a simple and elegant way. I'm envious, in fact, because I spec'ed this exact thing out in a meeting a few months ago but I could have just done it like he did and I would have used fewer keystrokes! Last year when .NET Core was just getting started, there was a "DNVM" helper command that you could use to simplify dealing with multiple versions of the .NET SDK on one machine. Later, rather than 'switching global SDK versions,' switching was simplified to be handled on a folder by folder basis. That meant that if you had a project in a folder with no global.json that pinned the SDK version, your project would use the latest installed version. If you liked, you could create a global.json file and pin your project's folder to a specific version. Great, but I would constantly have to google to remember the format for the global.json file, and I'd constan

R vs Python for Machine Learning

There are so many things to learn before to choose which language is good for Machine Learning. We will discuss each and everything about R as well as Python and the situation or problem in which situation we have to use which language. Let’s start Python and R are the two most Commonly used Programming Languages for Machine Learning and because of the popularity of both the languages Novice or you can say fresher are getting confused, whether they should choose R or Python language to commence their career in the Machine learning domain. Don’t worry guys through this article we will discuss R vs Python for Machine Learning. So, without exaggerating this article let’s get started. We will start it from the very Basics things or definitions. R vs Python for Machine Learning Introduction R is a programming language made by statisticians and data miners for statistical analysis and graphics supported by R foundation for statistical computing. R also provides high-quality graphics and

Top Tips For PCB Design Layout

Are you thinking about designing a printed circuit board? PCBs are quite complicated, and you need to make sure that the layout that you choose is going to operate as well as you want it to. For this reason, we have put together some top tips for PCB design layout. Keep reading if you would like to find out more about this. Leave Enough Space One of the most important design tips for PCB layout is that you need to make sure that you are leaving enough space between the components. While many people might think that packing components closely is the best route to take, this can cause problems further down the line. This is why we suggest leaving extra space for the wires that will spread. This way, you’ll have the perfect PCB design layout. Print Out Your Layout Struggling to find out if your components sizes match? Our next tip is to print out your layout and compare the printed version to your actual components. Datasheets can sometimes come with errors, so it doesn’t hurt to do