Click here to Skip to main content
15,911,030 members
Please Sign up or sign in to vote.
2.52/5 (4 votes)
See more:
Hi all,

I am very confused about the approaches used by C and C++ languages.
I know C uses "Top Down" while C++ uses "Bottom Up".
But i don't know why. I mean i am not getting the proper explanation.

Somewhere i read:

First thing Top down and bottom up are designing approaches.
As simple, in top down approach,first we are designing the
main module(i.e main function) and in that we will decide
what all other modules to be include then we will design all
other sub modules..this approach is used C prog language.

In bottom up approach, just contrast to top down,first we
design all the sub modules related to application then we
design main module and in that we will decide what are the
modules to be include.. for ex: we can design any no of
classes and in main only required classes and their
functions can be used ...this approach is used in c++ ......


But i am not sure that this would be the proper answer.

Is there any other reason??

And what about C# and JAVA??
Posted
Updated 30-Mar-18 0:54am
v2
Comments
Sergey Alexandrovich Kryukov 29-Nov-13 16:09pm    
Why are you asking us? Ask the guy who had written all that trash...
Sorry, I down-voted the answer, due to lack of the logic in the way you approach to learning things. You should not take what you read for granted and ask question assuming too much.
—SA
Maciej Los 29-Nov-13 18:11pm    
:laugh:
Atul Khanduri 29-Nov-13 18:33pm    
I think its no need to laugh, because one of the use of code-project is to ask your queries which you faced, either from code-project itself or from any other article or sites....
And for more read below comments....
Maciej Los 29-Nov-13 18:36pm    
I'm laughing from Sergey's comment. I'm not laughing from your question. Are we clear, now?
Atul Khanduri 29-Nov-13 18:37pm    
Yup....:-)

Quote:
I know C uses "Top Down" while C++ uses "Bottom Up

That is false.
C and C++ programming languages do NOT use neither bottom-up nor top-down approach. Bottom-up and top-down approaches are techniques the developers could use for solving problems. For instance some parsers are bottom-up while others are top-down.
Both C and C++ are well suited for using both the approaches (they are well suited for using none of them as well).
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 29-Nov-13 16:19pm    
Strictly speaking, not only this is false, rather it is a set of words, not really a comprehensible statement with some certain sense. This is what I call blah-blahology, a pseudo science, or imitation of science. My 5, but...
Please see also my Solution 2, where I try to go a bit deeper...
—SA
Maciej Los 29-Nov-13 18:12pm    
+5!
Atul Khanduri 29-Nov-13 18:39pm    
My vote 5....:-)
Please see my comment. Do you understand that you are doing wrong thing? You are reading some book and perceive what is written as if it was the law of nature. It is not. This is just some thoughts reflecting the way the author of this book or article looks at things. I would say, it just reflects the author's fantasy.

And then you are asking us, not even giving any links.

In fact, top-down and bottom-up approaches are not related to any specific language, and neither C nor C++ dictates or encourages any of these approaches. Moreover, neither top-down nor bottom-up approach, taken in any pure form, can provide a smooth and self-consistent method of development software. None of those over-simplified schemes can provide it. At best, it is always a combination. And any reasonable software development process is always much more complex and at the same time much more balanced than any of such approaches. First of all, it is always iterative, at least to some degree.

You need to apply much more critical thinking, just thinking and common sense while reading literature.

—SA
 
Share this answer
 
v4
Comments
Atul Khanduri 29-Nov-13 16:31pm    
It was asked in one of my interview, that's why i questioned here...
I googled it and found the same(that c uses Top-down and C++ uses Bottom Up) in so many sites.
And after reading those, i confused and asked here.

Here are the links where i got that information:

http://www.allinterview.com/showanswers/234.html
http://forums.asp.net/t/1891629.aspx
http://in.answers.yahoo.com/question/index?qid=20100625012803AAz7wpa
http://wiki.answers.com/Q/What_is_top_down_approach_in_c_-_programming#slide1

And many more...
Sergey Alexandrovich Kryukov 29-Nov-13 16:46pm    
Here is my advice: stop reading trash written by incompetent people. Yes, there is more... Isn't it obvious: there is always more trash than something valuable.

I can even explain why those people are incompetent: helping to prepare for interviews is a wrong idea in principle. They either waste time or fool people trying to make some money. You don't need preparations for interviews; you need knowledge and experience which only comes with study, learning and practice. There is no other way around. Not only reading interview questions and answers is a waste of time, it can create false knowledge. If you want our help, you should stop reading all that trash and refer it.

—SA
Atul Khanduri 29-Nov-13 17:10pm    
Yup i know, i never used to read any question to prepare for interview. But when he(interviewer)asked me this question(that from C and C++, which one uses Top-Down Approach and which one uses Bottom-Up Approach) then only i searched. Even i don't read any article related to this....:-)
Sergey Alexandrovich Kryukov 29-Nov-13 18:20pm    
I understand. Very good. Will you accept the answer formally then (green "Accept" button)?
—SA
Atul Khanduri 29-Nov-13 18:23pm    
Ya sure...
And i think you down-voted my question, which i dont think it is...!!!
Anyway thanks...:-)
I agree with the others that your premise is incorrect on several levels.

In my opinion, regardless of what you are developing, what language is used, what tools you use, you should design from the top down and implement from the bottom up.
 
Share this answer
 
Comments
Maciej Los 29-Nov-13 18:50pm    
Interesting point of view ;)
Stefan_Lang 4-Dec-13 7:31am    
I agree this is the ideal, but unfortunately this ideal is also the reason for analysis paralysis: You pretty much need to design everything to the smallest detail before starting to program when using this approach! If the project is anything but trivial, you'll never finish the design phase because you always discover more details and special cases - and if it's not you, someone will change the specification before you're done.
PIEBALDconsult 4-Dec-13 8:46am    
Sure, if you don't know what you're doing.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900