C ++ for rookies. How to learn what to avoid
C++ was created by the Danish computer scientist Bjarne Stroustrup in the 1980s as an object-oriented extension of C. for years, C ++ has been one of the most popular languages. WG. in our IT community survey 2020 for 51% of embedded developers this is the main programming language, and 25% of professional developers started with this language.
It remains unrivalled in terms of high-budget computer games, embedded software, system programming. Based on the C++ language was created Amazonas well as operating systems Windows.
Before we go further, we should mention that in the last decade C ++ has developed as a programming language. 3 versions have been released that have changed the way you program in C++.
C++11 – released 8 years after the previous version. Introduced lambda expressions, improvements in the implementation of smart pointers, the ability to automatically assign a type, or replace
nullptr. There were really a lot of changes, including in the Standard Bible, where there were m.in. new data structures (like tuples), class
std::threadsupporting threads, function template
std::asyncwhich allows asynchronous calls.
- C++14 – extended the possibility of type deduction by using this language feature also in lambda expressions or return types.
C++17 – further extension of type deduction, adding the possibility of using if and lambd in the constexpr construction (that is, one whose value is determined at compile time. In the standard library appeared, for example.
std::optional, that is, the template of a class that contains an optional value, or
std::filesystem, that is, a unified way of operating the file system.
This, of course, is not all the news in each version and there are many more. A good summary on this topic can be found in the list of “modern C ++ features”. In addition, this year we should look forward to the release of C++20, which will introduce m.in. co-programs and modules.
It may look scary, but it shows that C ++ is constantly evolving, which you need to be aware of when learning. Although the basics of C ++ remain the same as a dozen years ago, professional development uses a lot of features available only in modern versions. Therefore, at present it makes no sense to start learning from C ++ older than version 11.
Next, we will deal with the issue of educational materials and suggest what to use during learning and what to avoid. Let’s get started… from the end.
Effective c ++ learning-what to avoid?
You can devote a lot of time to learning, and yet gain little knowledge. All because effective learning is an art.
What to avoid to quickly master the basics of C++? Definitely not worth it limit yourself to books. Of course, we recommend reading and printed materials, but you should be aware that they quickly lose to the news. An example of this is the book” Symphony of C++”, which is extremely popular in Poland and was last published 10 years ago. Since then, new versions of C ++ 11, C ++ 14, C ++ 17 (about which the author, Jerzy grębosz wrote several books) have appeared introducing many changes. It is not worth wasting time and money on weak titles.
It is a common mistake to limit ourselves to Polish-language websites and materials. Most knowledge, and the latest, can be found on the English-language internet. The sooner you get used to using this language, the better. No English, don’t move..
Learning to code is not about learning by memory. It is important to be able to search for knowledge, study documentation and try troubleshooting yourself. It is important to understand, not to recite clichéd formulas. Therefore, it is worth reading interspersed with writing code, a lot of code.
And now the question: Where to look for knowledge?
The internet is, of course, a mine of knowledge and the best source of information for the programmer. On the web, you can easily find c ++ courses at various levels. Among them there is no shortage tutorials in various forms (text, video). Here are our suggestions:
– Learn how to Program with C++ – very good, but paid, English course (C++11);
– Cpp0x-a collection of very good, polish, free courses at various levels (C++11);
– C ++ course from zero to hero-interesting, polish course, for which you have to pay.
Despite the restrictions printed sources.do not completely abandon them, because they are a good support.
C++ Primer Plus-a very well written manual by Stephen Prat, which is worth a frequent look (C++11)
Effective modern C++ – good support in learning the latest programming language standards (C++11 and C++14);
C ++ primer-no, this is not a repetition of the first item from the list. This is the fifth edition of Stanley Lippman’s book, which is also often recommended by programmers (C++11)
Algorithms without secrets – while learning programming, it is worth stepping into the world of algorithms (this is not a book directly related to C++);
Clean code – from this book you can learn m.in. how to write clean code with a good structure, and good habits should be acquired from the very beginning of the adventure with programming (this is not a book directly related in C++)
The real science of programming is dealing with different programming challenges on your ownand not mindlessly copying code. Such challenges can easily be found on the internet.
HackerRank – a very popular service (more than 2 million users), where you should test your skills in practice;
Sphere Online Judge-this time a service in Polish, where you can find challenges with different levels of difficulty;
Code chef-another place where you can test your skills, a lot of competitions and tasks.
Leetcode-a large set of problems to solve and practice writing code in C++ (and not only)
There’s a lot of stuff on the web about C++. You can dress up on websites and communities that touch on topics related to language. Here are some of our suggestions:
– C ++ patterns-a great site that presents common problems with specific solutions. An example? Sorting items or replacing two values. There are also examples of implementation of some design patterns.
– Simplify c++ – a blog that encourages coding in C++ in the simplest possible way, by the way, contains an excellent discussion of the next features of the language.
– Standard C++ Foundation-website of the c++working committee. It is a kind of community center where you can find articles, news and information about events related to the language.
– C++ on Reddit-a very useful subreddit for tracking news and interesting articles about C++
– Questions on Reddit-a subreddit for asking questions. Allows you to ask more specific questions than, for example, StackOverflow.
Finally, a small reminder: developer never stops learning. If you are going to take coding seriously, accustom yourself to the idea of constantly developing your skills. We hope that the above materials and advice will be useful to you in this.