ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
1st of all this post is not about C++, it is about general programming. i know about functions, variables, compilers, interpreters etc etc but i have never done any real-life coding. i am trying to learn C++ as most of the jobs in my area are for the graduates/PGs carrying these skills:
1.) C++
2.) OOA & D
3.) Design-Patterns
(programmers who can comprehend at least 50% of "Design Patterns" by GoF)
4.) experience in real-life C++ projects.
5.) experience of UNIX
now there is only one good book available in my area: "Stroustrup" (by good book i mean an author who thinks C is not prerequisite for C++). i am trying to learn C++ from it but from last 2 months my progress is not so good. i only know just a handful of C++ constructs. i am not even able to understand the "Desk Calculator" programme in chapter 6 which forms the basis of chapter 8 & then 9.
i am not even able to think of the problems what programmes i should post. one day i tried to read "K&R2" i came into immediate programming mode & started to write small useful programmes given in exercises & also understood the concepts behind these programmes pretyy well but i am avoiding C as it is not useful to my situation & even i if put time to learn C it will only increase the gap between me & C++ & hence between me & the job, the opprtunity to make & stand on my own feet at age 25. hey, dont take it wrong, the Hacker within me loves C but the corporate does not :-(
i think the problem has more to do with "immamturity & newbiness" to
programming than with C or C++. i am confused & worried about my future & my younghood.
From my own experience I would carry on learning C then move on to C++. Alternately get a good book on C++, something by Deitel&Deitel will do nicely, C++ How to Program. The hardest thing to grasp in moving from C to C++ is the OO side of things. Although you could easily learn C++ without any C knowledge, you can employ similar techniques in C++ as used in C to construct class methods.
Of course c++ can be done with out C. Also your problem is not with c++ but with OO aspects. Object Oriented is just a method or a style to program and in reality it can also be done in C. What c++ or Java type of programming languages provide is the support for classes and objects. So first try to get the understanding about OO and then use C++ as an language for OO, and understand all the concepts with in c++(actually this should go simulteniously).
Do not use Stroustrup if you are newbie. It is though the best book its not at all good for newbie. Use boos like Teach you self C++ in 21 days or C++ Complete Reference or Thinking in C++(free available online).
Do not try to do some real life coding at the very first day, OOP takes time to learn, because its not marly programming constructs but it is rather to visualize the real life problem in terms of OOP. Robert Lafore book is also good.
Some thing about Desk Calculator, Well Stroustrup is the creator of c++ and if you try to program like him its difficult, actually that example and the entire book is written is a fashion that one can understand if one knows how programming languages work internally, rather then how to work with programming language. So just start with any other book and I am sure its not that difficult also.
Best of luck.
Last edited by hiren_bhatt; 12-23-2006 at 09:32 PM.
1st of all this post is not about C++, it is about general programming.
Actually, the rest of your post is about C++, and it seems like you're just trying to get a job. That's respectable, but I wouldn't call it "general programming". Learning a single language isn't going to help your programming overall, but it will make you an excellent programmer drone if that's what your target company wants. However, if they want their programmers to be able to think outside the box, experience in only one language will be a detriment.
Quote:
Originally Posted by arnuld
i am avoiding C as it is not useful to my situation & even i if put time to learn C it will only increase the gap between me & C++ & hence between me & the job, the opprtunity to make & stand on my own feet at age 25. hey, dont take it wrong, the Hacker within me loves C but the corporate does not :-(
You should be aware, if you're reading Stroustrup, that C++ allows 99% of all C code. For the most part, C++ = C + new features (hence the name). Learning C is not going to make you a worse C++ programmer! Why in the world would you limit yourself to learning only one language? Sometimes you've got to start at the conceptual "bottom" and work your way up! (or sideways)
And I wouldn't take it so hard, because C++ is one of the hardest languages out there. It has bunches and bunches of features coupled with syntax that is sometimes truly horrendous. Like the others have said, Stroustrup's book is the perfect reference for C++ -- once you know the language! It's terrible to start off in!
But I think you've got the wrong mindset about programming. You claim to know the theoreticals (variables and functions -- there's a lot more than that) and think the practicals should follow automatically. That's not the case. Programming is about equal parts knowledge and experience. And the best way to get better is to have those two proceed hand-in-hand, building both together. Write the code and learn the theory, lather, rinse, and repeat. And it takes time; you don't become great overnight.
Good luck. And please don't take this the wrong way, I'm not trying to be mean. I just believe that single-mindedness is a sure-fire way to drive yourself into a professional niche from which it is difficult to escape.
To the extent you want to design (or manage!) medium to larger scale projects, I would strongly encourage you to look at the Larman book. I've found it *incredibly* useful over the years - and I keep find myself coming back to it.
I my view the best introduction to OO is Object Technology: A Manager's Guide by David Taylor. It doesn't have any programming examples but in very simple language it explains the concepts of OO. (FWIW) Don't worry about design patterns until you understand OO.
but i am avoiding C as it is not useful to my situation & even i if put time to learn C it will only increase the gap between me & C++ & hence between me & the job,
I totally disagree. And my employer even considers C to be a prerequisite to C++.
Of course c++ can be done with out C. Also your problem is not with c++ but with OO aspects. Object Oriented is just a method or a style to program and in reality it can also be done in C. What c++ or Java type of programming languages provide is the support for classes and objects. So first try to get the understanding about OO and then use C++ as an language for OO, and understand all the concepts with in c++(actually this should go simulteniously).
what makes you think that trouble is OO aspect?
i dont think trouble is OO way of C++. i can't comprehend what exactly is the trouble but it is not because of OO way.
Quote:
Originally Posted by hiren_bhatt
Do not use Stroustrup if you are newbie. It is though the best book its not at all good for newbie. Use boos like Teach you self C++ in 21 days or C++ Complete Reference or Thinking in C++(free available online).
i have Eckel's book but trust me he uses "heavy C". one needs to know C & i speak so because i read 1st 5 chapters of his book. it is on my desk.
Actually, the rest of your post is about C++, and it seems like you're just trying to get a job. That's respectable, but I wouldn't call it "general programming". Learning a single language isn't going to help your programming overall, but it will make you an excellent programmer drone if that's what your target company wants. However, if they want their programmers to be able to think outside the box, experience in only one language will be a detriment.
whole corporate(except 10%, of course) moves in one direction, eyes blindfolded, programmers are run like horses by "pointy-haired-bosses". they donot know what is "outside of the box". they use .NET,C++ & Java because they are a Standard, not because they need to solve a problem[1][2]
Quote:
Originally Posted by taylor_venable
You should be aware, if you're reading Stroustrup, that C++ allows 99% of all C code. For the most part, C++ = C + new features (hence the name).
yes but in C++ it is really stupid to do:
"printf("%d apples", 5)" rather than "std::cout << 5 << "apples"
both are legal but i think latter shows the right & true use of C++.
Quote:
Originally Posted by taylor_venable
Learning C is not going to make you a worse C++ programmer! Why in the world would you limit yourself to learning only one language? Sometimes you've got to start at the conceptual "bottom" and work your way up! (or sideways)
so you say the way: K&R2 -> OOA&D -> Stroustrup is fine?
Quote:
Originally Posted by taylor_venable
But I think you've got the wrong mindset about programming. You claim to know the theoreticals (variables and functions -- there's a lot more than that) and think the practicals should follow automatically. That's not the case. Programming is about equal parts knowledge and experience. And the best way to get better is to have those two proceed hand-in-hand, building both together. Write the code and learn the theory, lather, rinse, and repeat.
Hmmm... you are saying, i ,with my curent knowledge, should start coding for a project.
Quote:
Originally Posted by taylor_venable
Good luck. And please don't take this the wrong way, I'm not trying to be mean. I just believe that single-mindedness is a sure-fire way to drive yourself into a professional niche from which it is difficult to escape.
well, thanks for the "Good-luck" :-) but what makes you think i possess "single-mindness"? & what is that "niche" you are talking about?
Arnuld, it seems like you are not happy with some replies, but still you should respect it.Anyways
Quote:
Originally Posted by arnuld
what makes you think that trouble is OO aspect?
i dont think trouble is OO way of C++. i can't comprehend what exactly is the trouble but it is not because of OO way.
Well if you remove OO from c++ then there is not much difference between c and c++, except for example in c we use printf and in c++ we use cout, provided if you call that a difference. Though internally it is, but thats not some thing which makes c++ different form C.
If you know OO then is must not be a trouble to learn c++. Moreover let me say that its OO that make c++ special, if you know how to write c++ code and do not know OO fundamentals then its not of any meaning. Nor do corporate want some one with c++ only, they want some one with strong fundamentals, such as concepts of OO and lot other things as-well.
So if you think that trouble in not with OO then there should not be a trouble with c++.
Quote:
Originally Posted by arnuld
i have Eckel's book but trust me he uses "heavy C". one needs to know C & i speak so because i read 1st 5 chapters of his book. it is on my desk.
Well in that case use the book I told previously
Sams Teach Yourself C++ in 21 Days. It says that the book is for those who come to c++ directly and dont want to go for c.
Last edited by hiren_bhatt; 12-24-2006 at 05:12 AM.
Arnuld, it seems like you are not happy with some replies, but still you should respect it.Anyways
you are mistaken. i never had that feeling.
Quote:
Originally Posted by hiren_bhatt
Well if you remove OO from c++ then there is not much difference between c and c++, except for example in c we use printf and in c++ we use cout, provided if you call that a difference. Though internally it is, but thats not some thing which makes c++ different form C.
If you know OO then is must not be a trouble to learn c++. Moreover let me say that its OO that make c++ special, if you know how to write c++ code and do not know OO fundamentals then its not of any meaning. Nor do corporate want some one with c++ only, they want some one with strong fundamentals, such as concepts of OO and lot other things as-well.
So if you think that trouble in not with OO then there should not be a trouble with c++.
now, that seems like a good point. now the things you mentioned in your earlier post make sense to me. it also means that C & C++ will become SAME if i remove OOP, Std. Lib. & Templates.
Quote:
Originally Posted by hiren_bhatt
Well in that case use the book I told previously Sams Teach Yourself C++ in 21 Days. It says that the book is for those who come to c++ directly and dont want to go for c.
Well if you remove OO from c++ then there is not much difference between c and c++, except for example in c we use printf and in c++ we use cout, provided if you call that a difference. Though internally it is, but thats not some thing which makes c++ different form C.
Actually, it is. Not the fact that C++ uses a different function for output, but the fact that that function is an overloaded operator.
i dont think trouble is OO way of C++. i can't comprehend what exactly is the trouble but it is not because of OO way.
I agree. OO was pretty easy to learn -- when I did it in Java.
Imho, the hardest thing about C++ is that when you declare class MyClass, you get three different types: MyClass, MyClass*, and MyClass& (plus const versions of each of these). And they behave very differently.
Code:
MyClass* p; // does nothing; declaration only
MyClass c; // calls default constructor
MyClass& r; // compile error; references must be initialized
In Java and Python, you only get one type: MyClass* (but spelled without the star). Makes things a whole lot simpler.
Actually, it is. Not the fact that C++ uses a different function for output, but the fact that that function is an overloaded operator.
Yes I know that it is an overloaded operator and if you carefully read my post(the one that you have quoted) i have implicitly mentioned by saying "Though internally it is". I did not mentioned explicitly because i considered not going in to whose inner details. But I still stick to what I have said, that if you remove OO from c++ then there in not much difference between c and c++, since the overloaded operator also comes from OO concepts.
Quote:
Originally Posted by Dan04
OO was pretty easy to learn -- when I did it in Java.
Well weather OO in easy or not, I would not like to go in a debate. Yes its not that difficult to learn but you really need to take care when you model some real life problem into OO. I have just so far emphasized the importance of OO(and nothing else) when you work with languages like c++.
Still this is my thought, some one may differ and there is nothing wrong in that,i respect it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.