When/Why to Move to C++?

Started by
57 comments, last by swiftcoder 12 years, 7 months ago
Thanks for that ApochPiQ. You do bring up great points. I can definitely empathize with your feelings on people spending little time in a language and thinking that they are competent with it. I was thinking of getting a good book to learn from by people that really know what they're doing (I generally hate YouTube and such 'tutorials) and spending about a month learning the basics and see how I like it. Sort of test driving the car before I decide to buy. Does that seem good to you and, secondly, could you recommend such a book or learning resource?
Advertisement
The book situation for C++ is actually pretty piss poor. That Stroustrups book is one of the best recommendations is telling ( as its a very difficult read ). C++ without Fear is probably the hands down best beginners text.

That said, if you do pursue C++ ( and like Apoch, I generally recommend against it ), you MUST buy Effective C++. It is singly the best C++ treatise ever written, and will make you a better programmer. There are only a handful of EUREKA!!! texts out there, and this is one of them.

That said, if you do pursue C++ ( and like Apoch, I generally recommend against it ), you MUST buy Effective C++. It is singly the best C++ treatise ever written, and will make you a better programmer. There are only a handful of EUREKA!!! texts out there, and this is one of them.


I want to add my 2cents here to wholeheartedly agree about Effective C++, it is the single most important book I've ever read on the subject. That said, it isn't for the beginner or feint of heart - but then, as has been pointed out, neither is C++.

[quote name='Serapth' timestamp='1315014033' post='4857004']
That said, if you do pursue C++ ( and like Apoch, I generally recommend against it ), you MUST buy Effective C++. It is singly the best C++ treatise ever written, and will make you a better programmer. There are only a handful of EUREKA!!! texts out there, and this is one of them.


I want to add my 2cents here to wholeheartedly agree about Effective C++, it is the single most important book I've ever read on the subject. That said, it isn't for the beginner or feint of heart - but then, as has been pointed out, neither is C++.
[/quote]

Actually, the ability to comprehend that book is a good litmus test for if you should (yet) even be bothering with C++ or not. It is not an especially difficult book to understand, as it is exceedingly well written, but you need a certain amount of exposure to programming before you can really appreciate what the book is teaching.
I wince every time I read someone's personal story where they "learned" C++ in a matter of days/weeks/even months, and then go on to talk about how easy it is and how they don't understand why people warn against it.[/quote]
Correct me if I am wrong... I believe that learning a language never stops. I mean, I study Computer Science, I have already taken advance courses on C,C++,Java and implemented advanced data structures, etc. But everyday I try doing something different, I discover a new thing about the language I have never imagined before.

@topic
Let's put some facts on the table:
  • C++ is greatly used on the industry because it is, until now, the best language to manipulate the lowest levels of your system and still be user friendly.
  • Because it access low level features of your system, you can program it to be as fast and powerful you wish it to be.
  • Now the important one, "With great power comes greater responsibility" - Stan's Lee teaching is perfectly applied here. Because you can go deep down the system, it will be likely to you to commit fatal errors, etc.
Now read the facts above with attention. None of them should scare you... they should challenge you, and that is a great thing for a programmer -> to be challenged, to seek more knowledge, true knowledge (not superficial stuff like what I am writing here xD)

My suggestion:
  • Learn everything you can about Object Oriented Programming. This is the soul of C++, Java etc. This is what gives us the power with a beautiful weapon in hands!
  • Don't be afraid to test everything you imagine on C++. If you think it would be cool to declare a pointer to an array of 10 positions and make that array move 20 steps instead. Do it, watch your system throw garbage at you, crash, etc.
  • When we clarify a doubt (like the tests above) it really gets stored on our brains (HD). Doing what we are told to do (good examples on books) are stored on volatile RAM memory that gets erased on sleep.

At last, dont think about C++ (and other languages) as a bunch of obscure syntax that are there to annoy you with errors, instead draw its little pieces on a paper, draw your program communicating with your system, draw all the pointers walking through your memory, make it real to you. And don't forget to learn everything about Object Oriented programming...

Enough of long answers =D
Hope it helps! (It helped me =D)
Programming is an art. Game programming is a masterpiece!
Instead of starting with C++, why not start with C?

It's a crazy idea, but C++ really builds off of C.

Yes, C++ is an Object Oriented language whereas C isn't; thus they are different languages arguably, but get used to the syntax first and then worry about OOD design - Design of any kind is done before coding thus should be studied separately from coding. Since C++ offers so much more than C, you may feel overwhelmed at first.

Just try C, you'll be learning C++ at the same time, basically. :)

Learn the *pointers, memory allocation, structs, enums, etc. And then move onto classes, (which you'll find remarkably similar to structs syntactically at least), templates, overloaded operators, etc.

*emphasized because pointers tend to be a pain until you get used to them.

Instead of starting with C++, why not start with C?

It's a crazy idea, but C++ really builds off of C.

Yes, it's an Object Oriented language whereas C isn't; thus they are different languages arguably. Since C++ offers so much more than C, you may feel overwhelmed at first.

Just try C, you'll be learning C++ at the same time, basically. :)

Learn the *pointers, memory allocation, structs, enums, etc. And then move onto classes, (which you'll find remarkably similar to structs syntactically at least), templates, overloaded operators, etc.

*emphasized because pointers tend to be a pain until you get used to them.








This is basically a mistake.

C++ was a (mostly) superset of C... when it was created, in 1983. Since then, many many things have changed in both languages. C99 is vastly different than K&R C.


More importantly, C++ was built on the bones of C as much out of necessity as any other reason. Put simply, C was a popular language of the day, so "being a better C" was a good trick for language adoption. To this day the language creator says the weakest points of C++ are from the inherited bits from C, and in many cases I agree with that. ( Although I think Bjarne Stroustrup is horrifically incapable of being introspective and acknowledging the many other flaws in his baby that he can't blame on other people, nor can he acknowledge that strengths of new languages like C#, of which he is horrifically dismissive. In some ways he is the ultimate C++ language troll, but at least, he has a good reason to be! ).


Anyways... anyone learning C++ today as "a better C" are doing it wrong, massively wrong. Hell, to someone learning and mastering C++ today should do everything in their power to avoid pointers and memory allocation, which are goals of what the newest C++ standard have worked towards. If you are constantly fiddling with bits and pointers with C++ these days, you are using it wrong.
Don't feel the need to switch to C++. This has got to be one of the most common traps for beginners. Anyone who advises otherwise is probably a good example of the Dunning-Kruger Effect.


Learn multiple languages -- this is a great idea. But as a beginner, I would only learn C++ as an academic exercise (sort of like learning assembly), not as a practical one. Does C++ have practical uses?... yes, but not for beginners. A beginner (or even intermediate) programmer is simply not skilled enough to make anything that requires C++. Think AAA console games that push the hardware as far as possible... are beginner's making these things? Are these games the next logical step after Space Invaders?

Whatever you do next will not require C++, and this language will just get in the way (unless your goals are purely academic and you don't care if you produce anything tangible).

Want a fun new language to try? Try Python or JavaScript. You'll learn a ton and grow as a programmer. These languages are usually even easier to work with than Java. And don't be scared off by my use of the word "easier". Some of the most skilled programmers out there use these languages to do amazing things. Many imply that using an easier language implies that you're stupid... in actuality it's the opposite: using the tools that makes your tasks easiest is very smart. The problem of programming is one of managing complexity. Anything you can do to reduce this complexity is good for you.

Heed our warnings: The most dangerous aspect of C++ is that, upon first examination, it feels like you understand it. The language appears "not as hard as they say it is" -- and this leads to the conclusion: I must be a genius! The reason so many people warn away from C++ is because most people aren't as brilliant as I.

Correct me if I am wrong... I believe that learning a language never stops. I mean, I study Computer Science, I have already taken advance courses on C,C++,Java and implemented advanced data structures, etc. But everyday I try doing something different, I discover a new thing about the language I have never imagined before.


You're absolutely right, and this is certainly the right attitude to approach programming with. I definitely wouldn't claim to have "stopped" learning in any language, especially not C++.

What I'm warning against is people who think they are done learning just because they wrote Program X and it appeared to work.


Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

If you think C++ is about low level access, give examples. Also, do you think C++ is portable?

C++ is a nuanced language. If you think it's not, try answering this question, which is a repost of a question I saw earlier:

What is the difference between: A *a = new A; and A *a = new A();

Answer that without Googling.

This topic is closed to new replies.

Advertisement