C++ As First Language

Started by
71 comments, last by Fredericvo 11 years, 9 months ago
Ok guys i have been hearing a lot about how bad C++ is as a first language. Well before i had read this topic here:http://www.gamefromscratch.com/post/2011/08/04/I-want-to-be-a-game-developer.aspx

I had already started learning C++ with this book C++ Primer Plus and went ahead till the second chapter with no real problems. The book has learned me so far how to creat functions, some statements and explained about the prepocessor directives,directives and very little about classes and objects. Well i had no prior experience from any other programming language but still i think i got how things work till now.

So my final question is.. Is really C++ that hard for a begginer? is it impossible to learn C++ as first language? or it just requires some more dedication than other languages? or maybe i just havent got to the difficult things yet....


PS. After i read that article that i mentioned before i started learning C# but it really didint got my attention so much and also the books where not traditional like those of C++ which first learn you how to write "hello world" , variables ect... Most of C# books empasize fist on Visual Studio and dont get you to the basics of the language first. I would like to work on a book that first learns me how to write and then introduce me to Visual Studio.

Sorry for my English.

Failure is not an option...

Advertisement

So my final question is.. Is really C++ that hard for a begginer? is it impossible to learn C++ as first language? or it just requires some more dedication than other languages? or maybe i just havent got to the difficult things yet....


C++ is harder than many other languages yes.
No it is not impossible to learn C++ as your first language. (You will run into some issues that you wouldn't encounter with other languages later on), Having a good book makes it far less painful though (Many of the worst issues will be avoided if you write modern proper C++ rather than the bastardized mix between C and C++ that some online tutorials teach, also make sure you understand each chapter before moving on)
and yes, things will get harder.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
Hi ShadowStep.

Many of the worst issues will be avoided if you write modern proper C++ rather than the bastardized mix between C and C++ that some online tutorials teach

A big +1 on that one Simon. Besides C is a lot better for understanding basic language syntax (functions, conditional instructions, loop instructions, basic code layout, etc.). C++ adds a lot more to that.
Regards,
MoroS84
Yes C++ as a first language usually isn't that great of an idea. There are some things in C++ that are just best learned through another language. I learned Python first and I don't regret it. C++ is still my favorite but only after I had a good hold on the other language. (Python, .net, Java)
No it is not impossible, and C++ is not the little baby eating monster like some people seem to suggest.

but

You are not doing yourself a favour choosing it as your first language. I think C++ has lots of things going that make it hard to get into:

1) It is HUGE. The point of C++ is to give you as much freedom as you want regarding programming paradigms and to try to never sacrify performances for that. This create some monsters, "my" C++ is vastly different from somebody else's C++. Most companies need to have "guidelines" to avoid coders going out to strange programming paths with C++. I came to love the simplicity that languages like Google Go offer.. a small, clear and elegant language that you can learn in 2 weeks and in which everybody's code looks much more similar.

2) Lots of things make sense from a compiler point of view, but from a user point of view, they don't make sense at all. ie, forward declarations, headers, non initialized variables.

3) Often C++ libraries and tools are targeted to "real men" biggrin.png Take DX11 as an example, no model loading, no font rendering, no scene management, geeky fullscreen management, no shader high level support. It's like, as a C++ programmer you are expected to do more work yourself. Compare this with things like XNA and you will see the different approach.

4) C++ is changing, C++11 (the new standard) just came out and brings a lot of changes in how things should be approached. But, at the moment, there is no book about C++11, so, most probably, you'll learn to do things in a way that will be considered "wrong" or "old" in a few months.

To recap, I'd suggest you to take a step back, and consider C# and especially Go as your introduction to programming.

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni

I don't think it is a good idea to learn C before learning C++ for several reasons:

  • Modern high level C++ has very little to do with C (you usually try to avoid pure pointers wherever possible, you don't do explicit memory management, you don't use C style I/O, preprocessor constants etc)
  • You're most likely not risking adopting a bastardized C/C++ mixture, it is almost impossible to avoid it, because as a beginner, you do not have the experience to discriminate between what you need for C++ and what you don't.
  • In C, simple programs are much harder to get right than they are in C++, because beyond "Hello World", you need to work with pointers or pointers in disguise (arrays), manual memory management, the syntax is much more restrictive in a lot of ways and so on...

If you *really* want to learn C++ as your first language, try to avoid the C parts of it as long as possible. It may be hard to understand the STL in the very beginning because template instantiation may take a while to get behind, but it will free you from all the nightmares, beginning C programmers used to have.

Don't get me wrong though, I am a huge C geek myself, but it took me years to let go of old C practices when I switched to C++ and even today as a professional software engineer, I sometimes have to force my self to do things in a clean way instead of the quick C hack way.

Oh, and if you can, try to find a book that covers C++11. I don't know whether there are any beginner books on this topic available yet, but with C++11, it becomes much more accessible to beginners.

But in the end, I typically advise people not to begin programming with C++ before they know some important concepts. It is possible, but it is also quite frustrating from time to time. You better start out with an easier language like python (or even this horrible C# thingy tongue.png)

Is really C++ that hard for a begginer?


'hard' isn't really the proper description. It's not hard to learn so much as it's hard to learn right. There's a lot of little gotchas that aren't obvious, and things that are correct yet less optimal than other things.

Worse yet, C++ requires a lot of overhead to make sure you're doing things right. That overhead would be better spent on learning to program. Since learning to program can be done with any language really, it's better for you to work with one that requires less overhead and has less gotchas.


I would like to work on a book that first learns me how to write and then introduce me to Visual Studio.


This is (arguably) unwise. Visual Studio is what you see first, and it's important to make sure that you can compile and run your code before giving you too much code to write (since you should be writing code as you work through the book).
If you are enjoying it, and not feeling disuaded or overwhelemed, then go for it. Programming is not an easy discipline no matter the language (for most people, anyway), even failures and false starts can be a learning experience - the only real danger is becomming discouraged and quitting. With C++, there is probably a higher "drop-out rate" due to added complexity and annoyances specific to that language.

Heck, I consider myself somewhat experienced, and these days I only use C++ when I have to (mostly this coincides with someone is paying me to) - it's not a particular easy and smooth experience for anybody, compared to many other languages (note that for many people, easy =/= enjoyable, however).
First of all, I thank you for all your answers they really help me out.

I wanna tell you that this book that I am reading C++ Primer Plus http://www.amazon.co...&pf_rd_i=507846
is updated to the

[color=#000000][font=verdana, arial, helvetica, sans-serif]C++11 standard[/font] cause it was realeased 2011 and in the description says that includes [color=#000000][font=verdana, arial, helvetica, sans-serif][size=1]

C++11 standard.

Apart from that it also does not mix the C language with C++ but it does[/font]

[background=rgb(250, 251, 252)] [/background]

mentions some things that you can skip(i skip them) for those who have come from C to make it easier for them.In addition i think that if i get each chapter right and do all the exercises correctly( and some similar more of my own) i should be on the right way.

I think from what you have mentioned here is that the most difficult thing about C++ is the freedom that it gives you in terms of how you can write a program in too many different ways.

Other than that what should i watch out? Where i might be tricked? So to be Extra alarmed in that chase....

Failure is not an option...

A good indicator of a bad way to teach C++ could be if you stumble across pure pointers or the keyword "new" in code example quite early (like earlier than halfway into the book). This *could* mean the book might still use some old fashioned (and thus error-prone and dangerous) ways to achieve certain things.
Even pure arrays might be an indicator of such a problem.

I don't know this book, but I don't think a C++ book can easily be adopted to cover C++11, because a lot of the basic workings of the language have been improved substantially, thus rendering section relying on the older standard obsolete.

Maybe somebody knows this book and can give a more facts based assessment of it.

This topic is closed to new replies.

Advertisement