Open Side Menu Go to the Top
Register
Learning C++ books? Learning C++ books?

02-02-2010 , 04:12 PM
Hi, I am interested in learning C++. I know and understand Java but feel that C++ would be a much better language and efficient to write in. I like learning from a book. Is there any books people would recommend learning C++ from the ground up?
Learning C++ books? Quote
02-02-2010 , 04:27 PM
Jeez it's been a long time for me (early 90's) since I learned C/C++. I would recommend a book that concentrates on C first, or learning plain old C (from a C only book) before you tackle C++.

When learning C++, you tend to gloss over the C fundamentals like memory allocation/lifetime, pointers, etc... and you focus on the C++ stuff like streams, classes, inheritance and the like. That means that if you just go straight into the C++ stuff, you miss the fundamentals (which is what will really help you as a programmer). I don't know if multiple inheritance turns you on more than pointer arithmetic, but a C++ programmer that does not fully understand lower level ("closer to the machine") concepts is not worth much. There will be lots of "why is this happening?" situations.
Learning C++ books? Quote
02-02-2010 , 04:36 PM
Quote:
Originally Posted by oldspeedy
Jeez it's been a long time for me (early 90's) since I learned C/C++. I would recommend a book that concentrates on C first, or learning plain old C (from a C only book) before you tackle C++.

When learning C++, you tend to gloss over the C fundamentals like memory allocation/lifetime, pointers, etc... and you focus on the C++ stuff like streams, classes, inheritance and the like. That means that if you just go straight into the C++ stuff, you miss the fundamentals (which is what will really help you as a programmer). I don't know if multiple inheritance turns you on more than pointer arithmetic, but a C++ programmer that does not fully understand lower level ("closer to the machine") concepts is not worth much. There will be lots of "why is this happening?" situations.
Ok awesome. I will learn C then jump into C++. Do you know any books off hand that would be good for learning strictly C then a book that is strictly C++?
Learning C++ books? Quote
02-02-2010 , 06:54 PM
Quote:
Originally Posted by BamBam192
Ok awesome. I will learn C then jump into C++. Do you know any books off hand that would be good for learning strictly C then a book that is strictly C++?
Not really.. I'd look around in Amazon and see the reviews, unless you can get some recommendation from someone else.

Good luck with that learning!
Learning C++ books? Quote
02-03-2010 , 12:07 AM
This is the bible for C

http://www.amazon.com/Programming-La...5169959&sr=8-1

Then you will want to get this from the guy who invented C++

http://www.amazon.com/C-Programming-...5170002&sr=1-1
Learning C++ books? Quote
02-03-2010 , 10:17 PM
Quote:
Originally Posted by Margaud
Then you will want to get this from the guy who invented C++

http://www.amazon.com/C-Programming-...5170002&sr=1-1
I've been going through the first couple chapters of this one and I wouldn't recommend it to a beginner. It focuses a lot on the differences between C and C++ and assumes the reader has prior knowledge of C.

@OP, IMO the small efficiency gains you get from C/C++ over Java aren't worth the extra pain required to handle manual memory management, think about pointers, etc. That said, C/C++ will help you get closer to the machine and peel away a layer of abstraction that Java hides from you, which is a good thing.
Learning C++ books? Quote
02-03-2010 , 10:34 PM
Quote:
Originally Posted by ispiked
@OP, IMO the small efficiency gains you get from C/C++ over Java aren't worth the extra pain required to handle manual memory management, think about pointers, etc. That said, C/C++ will help you get closer to the machine and peel away a layer of abstraction that Java hides from you, which is a good thing.
I'm curious about this remark. What I think you're saying is: "As a working programmer, you'll be more productive overall if you're coding in Java, even though the code comes out slightly less efficient. But you'll be a better programmer if you learned C/C++ first, so learning C/C++ has educational value even though you're better off working in Java once you've learned how to write effective C/C++ code." Or did I misinterpret?
Learning C++ books? Quote
02-03-2010 , 11:08 PM
Quote:
Originally Posted by EvilSteve
I'm curious about this remark. What I think you're saying is: "As a working programmer, you'll be more productive overall if you're coding in Java, even though the code comes out slightly less efficient. But you'll be a better programmer if you learned C/C++ first, so learning C/C++ has educational value even though you're better off working in Java once you've learned how to write effective C/C++ code." Or did I misinterpret?
Yes, essentially. Note that you don't have to learn C/C++ before you learn Java, nor do you have to be particularly good at coding C/C++, you just have to understand how stuff like memory allocation and pointers work.

You obviously can't be versed in every single layer of the software stack nowadays, but the further you abstract away from things, the more likely things are to break, and when they break (and they will), you need to have some idea how to fix them. Usually this involves having a basic understanding of how things work under the covers.
Learning C++ books? Quote
02-03-2010 , 11:25 PM
Quote:
Originally Posted by BamBam192
Hi, I am interested in learning C++. I know and understand Java but feel that C++ would be a much better language and efficient to write in. I like learning from a book. Is there any books people would recommend learning C++ from the ground up?
I'm not sure I'd recommend C++ if I wanted to be efficient. Things in C++ are always so error-prone, I get things done much faster with something like C#. I'd imagine Java has similar advantages, but I don't see Java surviving long-term.
Learning C++ books? Quote
02-03-2010 , 11:53 PM
Generally when people talk efficiency, they mean efficiency of the code when it is running. Not the time you take to right it and get it right.

Why do you think Java will not survive long term? Also, what is your definition of long term? Is 15 years long enough?

I agree with ispiked, don't learn a language, learn how to program. Having an idea of what the next layer down is doing can help you understand why your code is doing what it is.
Learning C++ books? Quote
02-04-2010 , 12:14 AM
Quote:
Originally Posted by ispiked
I've been going through the first couple chapters of this one and I wouldn't recommend it to a beginner. It focuses a lot on the differences between C and C++ and assumes the reader has prior knowledge of C.

@OP, IMO the small efficiency gains you get from C/C++ over Java aren't worth the extra pain required to handle manual memory management, think about pointers, etc. That said, C/C++ will help you get closer to the machine and peel away a layer of abstraction that Java hides from you, which is a good thing.
The way the thread was evolving, it was suggested he learn C first. So I gave what IMO were the two best books to start with...one being C and one being C++. So it's safe to assume the reader will know C by the time he reads the 2nd book.

Quote:
Originally Posted by TomCollins
I'm not sure I'd recommend C++ if I wanted to be efficient. Things in C++ are always so error-prone, I get things done much faster with something like C#. I'd imagine Java has similar advantages, but I don't see Java surviving long-term.
Regarding all the suggestions to use a higher level language, I think you guys are off base considering you have no idea what the OP wants to code for. Java and C# aren't gonna do you any good if you want to write kernels, drivers, *nix stuff. He stressed efficiency so he probably wants to stay away from a virtual machine.

The guy obviously wants to learn C++ so why start a language advocacy war?

FWIW I have been doing Java since 1996.
Learning C++ books? Quote
02-04-2010 , 06:47 AM
Quote:
Originally Posted by TomCollins
I'm not sure I'd recommend C++ if I wanted to be efficient. Things in C++ are always so error-prone, I get things done much faster with something like C#. I'd imagine Java has similar advantages, but I don't see Java surviving long-term.
Hmm Dude, what are you smoking? I am not a Java fanboy at all, but your statement about Java not surviving long-term is downright ridiculous. It's already been around for 15 years (since '95 or so), and given all that's written in it and continues to be developed in it, it has quite a long future.

Maybe long-term for you means 150 years? 300?

As to the comments abut C++, I agree with the other comments about nt starting a language war. It's just a bunch of opinions after all.

If I wanted to have the OP take somethign away from this thread is this: Learning low-level programming is very important for a programmer. Even if you never touch memory management by hand again (malloc/calloc stuff), the lessons learned will make you understand memory managers and trash collectors in higher-level languages much better. Once you play around with bits, you understand a whole bunch of things much better. So, learn it; be a better programmer. And don't get into language wars. It's always the same story: The language you don't know is the one that sucks.
Learning C++ books? Quote
02-04-2010 , 11:16 AM
Learning C should be the basis for any higher level language. I'd love for every developer to have an idea how to write assembly since that's where everything happens but most people don't feel the need to learn how stuff actually works.

To OP- learn C then move to C++.
Learning C++ books? Quote
02-04-2010 , 11:41 AM
This is the textbook I used for my first C++ class. That was 6 years ago, so there are newer editions available obv.

http://www.amazon.com/How-Program-In...5297913&sr=1-1.



Edit: you gotta learn C# before C++ imo.
Learning C++ books? Quote
02-04-2010 , 12:17 PM
Quote:
Originally Posted by AquaSwing
I'd love for every developer to have an idea how to write assembly since that's where everything happens but most people don't feel the need to learn how stuff actually works.
Shhh!!! Don't tell them the secret, it will bring our wages down :-)
Learning C++ books? Quote
02-04-2010 , 12:22 PM
Quote:
Originally Posted by duh
Edit: you gotta learn C# before C++ imo.
This is a great suggestion: C# imposes limits on what you can do for very good reasons. It is a gold mine to actually find out what those reasons are. If you go straight into C++ you will learn to multiple-inherit, for example. You will save time if you find out what about multiple inheritance is a bad idea and how C# addresses the same need without allowing you to implement bad design.
Learning C++ books? Quote
02-04-2010 , 04:58 PM
Quote:
Originally Posted by TheIrishThug
Generally when people talk efficiency, they mean efficiency of the code when it is running. Not the time you take to right it and get it right.

Why do you think Java will not survive long term? Also, what is your definition of long term? Is 15 years long enough?

I agree with ispiked, don't learn a language, learn how to program. Having an idea of what the next layer down is doing can help you understand why your code is doing what it is.
It depends. Execution efficiency is overrated in most cases. It really depends what you are trying to do, of course. If you are doing something highly computationally dependent, yes, efficiency will matter more. But spending 2 hours to do something rather than 20 hours (after tracking down all your bugs, leaks, etc...) is another argument for efficiency. It might be worth it to have to do things the hard way for performance benefits, and it might not be. If you are writing an OS or drivers, C++ is probably the way to go. There are many tools that are best for many reasons.

I think Java will be around in some form in 15 years (and likely longer), but it seems to not be growing very much anymore and seems to have reached its peak. On the other hand, I see a similar approach with .NET that is still going through tremendous growth. I could be wrong, I just don't see it getting any bigger than it is right now. Java was given a lot of hype when I was in school as this wave of the future, and it just seems to have really petered out. A lot of classes were switching from C++ to Java, thinking that's what employers would want. I see it going the way of FORTRAN and COBOL in 15 years.
Learning C++ books? Quote
02-04-2010 , 05:06 PM
LOL, your comment of Java in college reminded me of this most excellent article (and highly relevant to the OP's question): http://www.joelonsoftware.com/articl...vaSchools.html
Learning C++ books? Quote
02-04-2010 , 05:21 PM
Quote:
Originally Posted by TomCollins
It depends. Execution efficiency is overrated in most cases. It really depends what you are trying to do, of course. If you are doing something highly computationally dependent, yes, efficiency will matter more. But spending 2 hours to do something rather than 20 hours (after tracking down all your bugs, leaks, etc...) is another argument for efficiency. It might be worth it to have to do things the hard way for performance benefits, and it might not be. If you are writing an OS or drivers, C++ is probably the way to go. There are many tools that are best for many reasons.
I don't disagree with anything here, it was just more of a semantics point that this would be the first time I've heard someone say just the word "efficiency" and not specifically mean execution efficiency.

Quote:
Originally Posted by TomCollins
I think Java will be around in some form in 15 years (and likely longer), but it seems to not be growing very much anymore and seems to have reached its peak. On the other hand, I see a similar approach with .NET that is still going through tremendous growth. I could be wrong, I just don't see it getting any bigger than it is right now. Java was given a lot of hype when I was in school as this wave of the future, and it just seems to have really petered out. A lot of classes were switching from C++ to Java, thinking that's what employers would want. I see it going the way of FORTRAN and COBOL in 15 years.
My point of saying 15 years was that is how long Java has been around. And if it is around for another 15 like you said, I think 30 years is a serious number in the longevity of a language. It should also be noted that Java had a good 6 year jump on .NET, so it is not surprising that java has started to level out and .NET is still growing. Don't get me wrong, I think .NET does a lot of things well (even better than Java) and C# is my preferred language. But to say that Java doesn't have any longevity, just isn't seeing the whole picture.
Learning C++ books? Quote
02-04-2010 , 08:29 PM
Quote:
Originally Posted by TomCollins
It depends. Execution efficiency is overrated in most cases. It really depends what you are trying to do, of course. If you are doing something highly computationally dependent, yes, efficiency will matter more. But spending 2 hours to do something rather than 20 hours (after tracking down all your bugs, leaks, etc...) is another argument for efficiency.
Yep, this is one of the arguments made in favor of scripting languages (PHP, Perl, Python, etc.)

Quote:
I think Java will be around in some form in 15 years (and likely longer), but it seems to not be growing very much anymore and seems to have reached its peak. On the other hand, I see a similar approach with .NET that is still going through tremendous growth. I could be wrong, I just don't see it getting any bigger than it is right now.
It really depends on where you look. Java is still pretty ubiquitous in enterprise applications, both Web and backend. There's also a pretty good ecosystem built up around it (tools like Eclipse, Web frameworks like Spring and Struts, Web servers like WebLogic and WebSphere, etc.) Most Web startups, on the other hand, are using a completely different stack to do Web development.

On the .NET side, I'd mostly agree. Novell created Mono, a .NET runtime implementation for Linux, and now a lot of Linux desktop applications are written using C#. There's also a case to be made for C# growing as Silverlight is used more.

On the concurrent processing side of things, however, most of these older languages don't offer much besides threading, which sucks. To really utilize all the processing power in next-gen computers, I think we're going to turn to (functional) language such as Clojure, Erlang, and Haskell, which offer new parallel computing models like actors, message passing and software transactional memory.
Learning C++ books? Quote
02-05-2010 , 12:33 AM
To get us back on track, OP, make sure you give iTunes U a search for podcasts of college courses in programming, if you can find one it will be as valuable as a good programming book.
Learning C++ books? Quote

      
m