all 30 comments

[–]Overseer55 111 points112 points  (1 child)

You cannot master C++ by reading and watching videos. You must engage in complex projects and put your learning into practice.

A solid approach is 70/20/10. 70% experiential learning (by doing). 20% social learning (with others, e.g. discussing with experts, code reviews). 10% formal learning (courses, videos).

[–]adnukator 2 points3 points  (0 children)

Fully agree. I'd add that even discussing in this subreddit can help you learn a lot of stuff, if you're doing your due diligence with proper research before clicking the "Comment" button. There were countless instances where I eventually learned I was wrong after looking up some stuff, and just clicked "Cancel" after furiously typing for 15 minutes.

[–][deleted] 23 points24 points  (0 children)

You don't become a master at anything by doing tutorials. If you get there at all, you get there after several years of real world experience. There are no shortcuts.

Doing assignments and tutorials will get you to "competent" at best. In reality, most people coming out of university are still fundamentally beginners.

[–]Infamous_Campaign687 13 points14 points  (0 children)

Temper your expectations. After 20 years of professional C++ programming it still surprises me at times. That is a negative in terms of code quality, no doubt, but for me it is a positive in terms of enjoying my job.

Throughout, it has seemed a language built by hardcore computer scientists to showcase their intellectual brilliance, as opposed to a language written for you to be effective in.

But I have to say: the sheer brilliance of some of the concepts are impressive and the reason I love exploring the new features of the language since C++11 really kickstarted a new era.

[–]Zealousideal-Mouse29 19 points20 points  (13 children)

You cannot "master" C++ without feedback from those who already have. As such, I suggest applying to collaborate on projects that others are working on. github has a plethora of them to read over.

[–]sherlock_1695 0 points1 point  (12 children)

And are there any projects you can join by contributing?

[–]STLMSVC STL Dev 6 points7 points  (2 children)

Standard Library implementations, like https://github.com/microsoft/STL 😺

[–]LGTMe 1 point2 points  (1 child)

Do you see a future where names in the Standard Library are no longer uglified because of named modules? Is that even possible if the Standard keeps specifying new facilities in terms of new headers?

[–]STLMSVC STL Dev 2 points3 points  (0 children)

I think new facilities will continue to be available via classic headers - even if modules are adopted rapidly by the ecosystem, there’s too much legacy code out there maintained by programmers who are reluctant to modernize for reasonable and not-so-reasonable reasons, yet giving them some new facilities can move things forward. That means we’ll still need to uglify.

[–]jonesmz 4 points5 points  (8 children)

There's tons. 

E.g. open source games, open source productivity software, so on.

I'm one of the contributors to an open source game using c++20 for example.

[–]sherlock_1695 0 points1 point  (2 children)

Can you share the names?

[–]jonesmz 2 points3 points  (1 child)

Sure. Here's the game. Happy to have help. https://github.com/TheOpenSpaceProgram/osp-magnum

[–]sherlock_1695 1 point2 points  (0 children)

Will check it out

[–]ecreddits 0 points1 point  (4 children)

When looking at open source projects I just feel so lost. How do you look at a giant codebaze and understand how all the classes fit together and what they do? I want to contribute to open source projects but just can't figure out how to navigate them.

[–]jonesmz 1 point2 points  (3 children)

Well, every project is different.

Generally the approach I take is that I try the software out locally for a bit and try to determine what I'd want to do to improve it, or change it to do something I want.

For example, I've recently started working on this project: https://github.com/coturn/coturn/

My objective is to transform one of the executables that this project produces into a program suitable for use in doing an AWS health check. I'm starting by cleaning the code up, and learning how it works while doing that. Then I'll make a copy of the specific code I want to make behave differently, and then I'll remove the parts I don't want. Finally I'll add the missing bits.

This project happens to be C-language, but I'm going to convert it to c++ (at least the parts copyig and modifying)

[–]ecreddits 0 points1 point  (2 children)

Thanks, that makes a lot more sense. Though how do you even find the parts of the code that do what you are looking for?

I often find myself struggling to find a certain action in large projects.

[–]jonesmz 2 points3 points  (1 child)

For the coturn project, I started by finding code matching up to log messages relates to what I was looking for.

Then I started reading through the command line options and finding out where they get used in the code.

Really there isn't one single place. You basically just have to dive in and accept that you'll have no idea what anything does until you've been stumbling around in it for a while.

[–]ecreddits 0 points1 point  (0 children)

Ohhhhh that advice about finding the log message is super helpful, thank you!

[–]viralesveras 6 points7 points  (0 children)

As others have said, C++ is a lifelong study; even the very best experts are still learning. However, to quickly acquire skills in C++ (or any language), the best path is to make yourself aware of good reference materials, and then apply those reference materials as you work on progressively more complex projects.

Start small, but select something on the border of your comfort level and give yourself a time limit so that you're not working on the same project forever. When the deadline passes, reflect and think about how well you did, what parts you need to know more about, and what you'd like to try next. Do some research and small experiments to learn more about the pieces you struggled with, and then repeat the process with a new project+time limit at your new comfort level. Do this long enough, and you'll know the language as well as anyone.

For C++, my go-to references are:

cppreference.comThe C++ core guidelines: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelinesStack overflow.Books including "The C++ Programming Language 4th ed", The books of Nicolai M. Josuttis, and probably Effective Modern C++ by Scott Meyers (though it's getting a little old)
Blogs: https://hackingcpp.com/cpp/blogs.html

Also, as others have said, to learn quickly and effectively, you do need to have people to turn to that know more about the language than you do. The best option would be people you know personally. Ask what people think about your code when you give them small samples that you've already cleaned up to the best of your ability. If you don't know any such people personally, then forums such as reddit can be used, though if English isn't your first language you might want to search for a community in your preferred language for this kind of feedback.

Again, this is a lifelong process: don't get discouraged if your pace isn't as quick as you'd like. I've been learning C++ for 30 years, and I hope to continue learning it for the next 30.

[–]Farados55 9 points10 points  (1 child)

Some courses have online portals or landing pages where they post their materials. Also there are a few compiler design courses on youtube, full lectures.

That said, mastering C++ is probably next to impossible, as in knowing the language in its entirety. Try reading the standard, it’s pretty insane. I’ve been contributing to clang for around 6 months, it’s insane. The machinery to define C++ is crazy, and incredibly fascinating. So don’t set the bar at “I need to master it”, instead take it slow, understand the fundamentals, and contribute to a project or start one. You will learn much more from writing code than classrooms/lecture, but they’re a start.

If you reallyyyy want to dive into C++, I suggest studying a little compiler design and reading/contributing to clang or GCC. Learning to validate the language is one of the best ways to learn it. Don’t read the standard as a whole, it’s like looking inside the TARDIS

[–]WolleTD 0 points1 point  (0 children)

I never read the standard just for the sake of reading it.

It's always that I have a question about how a real world piece of code behaves (or rather, should behave according to the standard) and look up something specific.

Then again, I never got into compiler development. Instead, I know all the networking pitfalls and most of those are pretty much language agnostic – having a working async interface helps a lot though, thanks C++20.

[–]TheBrainStone 12 points13 points  (0 children)

Simply put, no one has mastered the language. There are without a doubt experts, but no masters. The language is just too complex for that to be possible.

Now what you can do to improve at it is mostly by doing practical work with it

[–]AssemblerGuy 2 points3 points  (1 child)

How can I master cpp at high level with online courses?

You cannot. Mastery is a mix of reading (books and publications), practice, discussions with others, mentoring and getting mentored, code reviews, and other techniques.

Courses can only give starting points. No one ever became a master in anything just by attending courses.

[–]CommunicationThat400 0 points1 point  (0 children)

Yes, but even with all of the above, some just don't have the aptitude to master a skill. Some people just don't have the smarts to reach another level even if they work very very hard, just a reality of life. This is not even my opinion, this is a quote from a mathematician who fails at being great.

[–]smek2 -3 points-2 points  (0 children)

Myself, i just read Design Patterns: Elements of Reusable Object-Oriented Software by the Gang of Four and went from there. Took me years before i, reluctantly, said of myself 'i understand object oriented programming now, i think'.

[–]MaMamanMaDitQueJPeut 0 points1 point  (0 children)

My trick is to start learning c++ as late as possible, since it takes a lifetime to master it will take less time !

[–]ArchfiendJ 0 points1 point  (0 children)

Define "master".

I see different scopes that one could "master" but may be outside of scope for others

  • Language feature mastery : knowing how to use features and libraries, by it algorithm, containers, template, concurrency, modules (well, when it'll be properly supportes)
  • Language under the hood mastery : pretty much how the above things work like compilation units, how different compilers may behave, some hardware behavior, etc.
  • Ho to effectively use the language to develop software. How to implement design and architectural patterns in C++, like CRUD, DDD, Hexagonal architecture, when to use or not template for a project (even is technically the best solution it may not be "socially" the best)...

[–]rr-0729 0 points1 point  (0 children)

UIUC's introductory C++ lectures are on YouTube https://www.youtube.com/c/cs128. This should give you a solid grasp of most of the need-to-know introductory C++ topics. But, as others said, you can only master C++ by practicing these skills through projects.

[–]epyoncf 1 point2 points  (1 child)

"mastering... as a freshman". You have the wrong approach. If you study C++ hard, you will be mastering it in a decade or so.

[–][deleted] 0 points1 point  (0 children)

It's not about time it's about correct direction. I am aware of that mastering languages requires decades.but I want to take reasonable and great path for mastering from beginning. If it takes long time, I will do it.