Member Avatar for Fjolsvidr

I'm looking to learn C++ from online sources. Which would you recommend considering I have no prior programming experience. Also, is it necessary or helpful to learn C beforehand?

Recommended Answers

All 8 Replies

I would invest in a good book like Koenig and Moo's Accelerated C++ (among others). Books like this take the approach of teaching C++ from the ground up, starting you out with C++ (and the standard libraries) rather than techniques drawn from C. The idea of learning C first is becoming passé, I think.

http://www.cplusplus.com/ is a great site for references and tutorials.

Others will be able to give you their suggestions, so watch for more replies.

Member Avatar for Fjolsvidr

Thanks for the reply, I'll be checking out cplusplus.com. Not related but, I have another question in mind. Among Java, C, C++ and Python which in your opinion is the most valuable to know?

That's one of those questions that definitely depends on the project you are working on, etc. To me, if you know one of Java, C, or C++ you shouldn't have any problem learning the others and switching between them, but again that's just my opinion. I don't know much about Python, but it too is widely used and those that use it seem to enjoy it.

commented: :) cool! and nice avatar too. +12

I can't give you much book suggestions or basic online tutorial (because my years of learning basic C++ are far behind me), but there is one site (in addition to www.cplusplus.com) that is key resource for understanding and knowing how to program well, that is: http://www.parashift.com/c++-faq-lite/

As for learning C before getting into C++: C is more low-level and require you to deal with memory allocation, arrays, pointers, null-terminated strings, etc., and these low-level processes occur "under-the-hood" of C++ standard library functions and classes. I would say that it is important to understand C code and how it is done such that you have a good idea of what is happening under-the-hood of C++ code. But, don't "learn C" in the sense of becoming proficient at it. Because if you are too accustomed to C programming you run into the danger of moving into C++ programming and wanting to resort to those C functions and constructs that you are familiar with and these are almost always a worse and less-effective choice than their C++ equivalents.

One caveat on that, if you are already familiar with another programming language similar to C (like Fortran, Matlab, Pascal, etc.) and you are comfortable with how procedural programming works (you know concepts like variables, types, identifiers, pointers, parameters, functions, dynamic arrays, stack vs. heap, compile-time vs. run-time, etc.) then you can go straight to C++. So, basically, understanding C before learning C++, is another way of saying, understand procedural programming before learning object-oriented programming (and mind as well do it in two languages that have almost the same syntax, i.e. C and C++, this way the transition is easy).

But, BTW, most basic C++ books or online courses will introduce C or at least the basic concepts of procedural low-level programming before getting into more "typical" C++ coding that usually is more object-oriented and higher-level (you can see in a book's table of contents that basically all chapters before the one that mentions "classes" in the title are about procedural programming).

commented: Well said! +12
Member Avatar for Fjolsvidr

Then I'm going on with C++, moving on to the others. Thanks for your help.

Edit: mike_2000_17, thanks for the reply. I understand what you mean, and as an absolute beginner I'll take your advice and have a look at the concepts you mentioned.

>>Among Java, C, C++ and Python which in your opinion is the most valuable to know?

IMO, amongst the serious programming languages, that is: C, C++ and Python. They each address a different realm.

C is mostly found for very low-level codes that either cannot be in C++ because of platform limitations (like micro-controllers for examples) or because it is simply easier to do very low-level stuff in C than in other languages (typically, hardware drivers are programmed in C).

Python is typically used for very high-level programming. Usually, you find it alongside C++ libraries (so-called "Python bindings"). Typical uses of Python are: writing plug-ins for existing applications; or having applications that are highly customisable.

C++ is typically for everything in between (I would say around 95% or more). C++ can do everything from extremely low-level to extremely high-level, but it sort of gets a little bit inappropriate at the fringes and that's where C and Python come in play. C++ is extremely powerful and is by far the best tool for any typical "number-crunching" programming (like game engines, simulators, complex software (with GUI), networking, artificial intelligence, image processing, etc.). However, at the very low-level (e.g. hardware drivers), some rules of C++ become a bit annoying and C is usually favoured. And at the very high-level, it is hard to completely wash away the underlying mechanisms from the C++ code, and thus, the high-level programming is not as easy as it should be by definition. Often, "hiding away" C++ implementations behind Python bindings is the favoured way to hide the underlying complexity and expose only a simple high-level interface via the Python scripts. This is how most big projects turn out (especially open-source software on Linux).

As for Java... well... in my opinion, it's a toy for children. It's like saying a small toy electric car is nice to have, you can learn how to do simple driving, you can go up and down your street with it, you might even impress the other kids in the neighbourhood, but, one day, you will have to travel some serious distance, possibly going on the highway, and that toy car just won't do it. C++ is like a Formula One. It is also not so valuable in the job market.. I have seen too many people come out of a University curriculum that chose to only teach Java or C#, and then they have trouble finding a job because employers are mostly looking for C++ programmers. Employers know that a good C++ programmer can perform well in a much wider range of applications and of other programming languages (including Java or C#).

Member Avatar for Fjolsvidr

>>Among Java, C, C++ and Python which in your opinion is the most valuable to know?

IMO, amongst the serious programming languages, that is: C, C++ and Python. They each address a different realm.

C is mostly found for very low-level codes that either cannot be in C++ because of platform limitations (like micro-controllers for examples) or because it is simply easier to do very low-level stuff in C than in other languages (typically, hardware drivers are programmed in C).

Python is typically used for very high-level programming. Usually, you find it alongside C++ libraries (so-called "Python bindings"). Typical uses of Python are: writing plug-ins for existing applications; or having applications that are highly customisable.

C++ is typically for everything in between (I would say around 95% or more). C++ can do everything from extremely low-level to extremely high-level, but it sort of gets a little bit inappropriate at the fringes and that's where C and Python come in play. C++ is extremely powerful and is by far the best tool for any typical "number-crunching" programming (like game engines, simulators, complex software (with GUI), networking, artificial intelligence, image processing, etc.). However, at the very low-level (e.g. hardware drivers), some rules of C++ become a bit annoying and C is usually favoured. And at the very high-level, it is hard to completely wash away the underlying mechanisms from the C++ code, and thus, the high-level programming is not as easy as it should be by definition. Often, "hiding away" C++ implementations behind Python bindings is the favoured way to hide the underlying complexity and expose only a simple high-level interface via the Python scripts. This is how most big projects turn out (especially open-source software on Linux).

As for Java... well... in my opinion, it's a toy for children. It's like saying a small toy electric car is nice to have, you can learn how to do simple driving, you can go up and down your street with it, you might even impress the other kids in the neighbourhood, but, one day, you will have to travel some serious distance, possibly going on the highway, and that toy car just won't do it. C++ is like a Formula One. It is also not so valuable in the job market.. I have seen too many people come out of a University curriculum that chose to only teach Java or C#, and then they have trouble finding a job because employers are mostly looking for C++ programmers. Employers know that a good C++ programmer can perform well in a much wider range of applications and of other programming languages (including Java or C#).

While doing the comparison did you take all the languages into consideration or these four especially because I asked about them?

Well.. I would say C, C++, and Python are the most main-stream languages because they solve their part of general programming problems. But there are many other programming languages that are specialized to certain areas. But when it comes to general programming problems (like 90-95% of software that is written), nothing beats this trio. But you do find people using alternative languages for general programming problems, like Java, C#, C++/CLI, J#, Delphi, Ruby, Perl, Haskell, etc. etc., some may, arguably, be better in certain circumstances and stuff, but overall C++ rules! (both in terms of feature-richness and wide-spread use)

As for domain-specific languages, there are of course languages like Matlab (for numerical analysis in general), Fortran (for hardcore scientific computing, like programming simulation software to run on super-computers), LabVIEW (digital signal processing and data acquisition), etc. These are in a separate category and they are, of course, extremely linked to what they are applied to. They can't really be factored into any comparison with general-purpose programming languages (well, maybe Matlab can be compared to C++ in the context of numerical analysis, but that is a bit of a stretch).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.