I always wondered why C++ was so hard to learn.. What's about C++ that makes it really hard to learn? Anyone have an answer??
I always wondered why C++ was so hard to learn.. What's about C++ that makes it really hard to learn? Anyone have an answer??
IDE and Compiler - Microsoft® Visual C++® 2005 Express Edition
Operating System - Microsoft® Windows® XP Home Edition SP2
Probably because of its complexity and most notably, the pain to get things working with GUIs and such.
It's not hard to learn, it just has a steep learning curve; you have to learn a lot to write even basic programs.
It may be due to the fact that the designers of the language value utility over ease of use. Not that ease of use is not a priority, just in the scheme of things it is a low one.
It is too clear and so it is hard to see.
A dunce once searched for fire with a lighted lantern.
Had he known what fire was,
He could have cooked his rice much sooner.
GUIs are not any part of C++.
C++ has a lot of complicated rules to learn such as Koenig lookup, SFINAE, RAII, exception safety etc. It is also extremely flexable, allowing such things as template meta-programming.
You only pay for what you use, but when there is so much you can use, it takes a lot if you want to learn it all.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
Id say over C is harder to learn as it is more low level and its memory management is more complex than in C++. C heavily relies on pointers more than C++ ( all pass value is done using pointers in C as references do not exsist ). But you write a complex program in C++ with a bit more ease than if you used C.
Both languages can do similar things although the main addition to C++ is OOP, which strives away from the procedual programming structure that C uses, although there is nothing wrong with that.
Double Helix STL
As most others have said: C++ is a LARGE language, and one that offers great flexibility in how you go about solving a problem. And being backwards compatible with C [1] makes for even more possibilities of confusion, since almost anything that can be done in C can also be done in C++, including almost all of the "mistakes" that can cause run-time bugs. C & C++ aren't really strongly typed languages, which also allows simple mistakes to go unnoticed until the phase where you run the application, rather than detecting mistakes earlier on.
If you compare C++ with other languages, it is a bit more complex because it relies more on the programmer to do things right. In other languages, the compiler or language run-time will look after things in a different way than in C/C++. Typical things are memory management [although for small apps, that can be fairly much ignored], array boundaries [which is definitely one of the things some other languages enforce].
But you also have to consider that LEARNING TO PROGRAM is a difficult task in itself. Since C/C++ are very "free" languages, you have many choices of how to do things, and there is little checking for mistakes. This makes it unsuitable as a beginner language, in my opinion. Java or even Basic would be better choices.
[1] It is certainly a good idea for making the C++ language accepted, and it also makes it much easier to interface a C++ program with a C-based OS. Both of these are sort of necessary to make the C++ language "work well with other products".
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
I would not say that C++ is a large language per se but it is a complex language in that it has many many features that may be hard to comprehend at first.
C++ is simple to learn.
Try assembly, now that's just evil...
Nah, assembly is easy. C++ has many more things where you as a programmer can get into a situation where you don't understand what's going on.
Assembler is generally relatively easy, it uses very small building blocks, so the code tends to get very long (lots of lines, not necessarily more kilobytes) very quickly. Using small functions or blocks of functionality is the key to assembler programming.
Of course, writing HUGE amounts of code in assembler is hard, because there's a great risk that you don't split the code into managable functions/blocks.
And of course, you need to understand what you are doing - which can be somewhat ignored in C or C++. But the language itself is much easier.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
No way. In assembly (or even C to some degree), you need to do everything yourself, which could easily result in "oops's" creeping in. Plus all the instructions in assembly are 2 or 3 letters which makes it pretty hard to read.
I guess it just depends on how your brain works. If you're one of those people who can memorize just about anything, then assembly might not be so hard, but for me things need to make some sort of sense (at least to me) before I can memorize it. Since C++ is more or less in plain English, it's easy for me to read.
I guess you are right - it depends on who you are, and what sort of "mind" you have. It also depends on experience. If you don't know how to make a decimal number string (for example to print it) from an int in C, how can you be expected to do it in assembler - in C you can "cheat" by using sprintf, printf or something like that, but in assembler you can't call those [unless you happen to have a C-library function floating around that you understand how to call].
I learned assembler a long time before I even SAW a C program. Because C was still a "new" language when I started programming. I learned the following languages in this order:
Basic, Z80 assembler, Pascal, PDP-11 Assembler, 6502 Asm, 8086 Asm (16-bit), 68K Asm, VAX-11 Asm, C, 29K Asm, x86 (32-bit) Assembler, x86-64 Asm, C++.
I also know enough Lisp, Fortran and Cobol to roughly get an idea of what something does, but I wouldn't say I "know" either of those languages.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.