Re: Learning C++
Posted: 03 Apr 2019, 23:47
I've had to learn a lot of C++ recently, so I think I have something to say as a peer.
I have to say though, that I had previous programming experience before I started to code things with OpenMW. I had written some stuff with various languages (including some C++), but I still considered myself very much a beginner. I do agree that C++ might not be the easiest language to learn, but I also think that straightest way to learn C++ is learning C++ straight away, not other languages. This does depend on your starting understanding though, if you think you know absolutely nothing about coding, then maybe learning some other languages can help you understand coding in general.
Other advice, based on what has worked for me:
- Jump straight into C++. Get working on something regarding OpenMW. Try to understand what a limited piece of the code does. Hack it to see how it really works. This is a bit tough if you know nothing of coding, so expect to progress slowly at first.
- Read developer checklist at OpenMW wiki, and related...
- Browse through the issues at gitlab, and try to solve them. If you think you've created a solution, make a merge request / pull request. Make them early, and if possible, keep them small and limited. I think I'm breaking the latter advice all the time though.
- There are some OpenMW related standards, and it helps to stick with them. Try to understand why OpenMW coding standards are as they are.
- Ask help, there are skilled people around, and many are willing to help. There are some people who really know their stuff, then there are people like me, who might want to help, but have limited understanding, and then there are all other sorts of people too.
- Albeit there might be better options, I like to use std::cout all the time to check statuses and values of various variables. C++ variable types and their interactions, pointers, references, casting types etc. can get complex. Nobody gave me this advice, but it has helped me personally a lot.
- Learn the basics of keywords: pointer, reference, casting... also, operators. You don't have to learn all of them at once though.
- For C++, I think that reading about "Rule of Three", "Rule of Five" and "Rule of Zero" has increased my understanding of memory management. Learn at least first what's a class constructor and class destructor.
- Whenever using some set of libraries (Qt for example), read the docs, and pay attention to memory management. Many frameworks tend to do automatic memory management too, so you don't have to write malloc/free or new/delete all the time after all.
- I like to use Atom to code. There are other options, can't really say why one is above other, but personally I like Atom because it's free, clear and simple to use, it feels intuitive, and there are advanced features under the hood, but still not cluttered, and it works straight out of the box - you get to code straight away (you don't have to do any extensive setup on coding software).
I have to say though, that I had previous programming experience before I started to code things with OpenMW. I had written some stuff with various languages (including some C++), but I still considered myself very much a beginner. I do agree that C++ might not be the easiest language to learn, but I also think that straightest way to learn C++ is learning C++ straight away, not other languages. This does depend on your starting understanding though, if you think you know absolutely nothing about coding, then maybe learning some other languages can help you understand coding in general.
Other advice, based on what has worked for me:
- Jump straight into C++. Get working on something regarding OpenMW. Try to understand what a limited piece of the code does. Hack it to see how it really works. This is a bit tough if you know nothing of coding, so expect to progress slowly at first.
- Read developer checklist at OpenMW wiki, and related...
- Browse through the issues at gitlab, and try to solve them. If you think you've created a solution, make a merge request / pull request. Make them early, and if possible, keep them small and limited. I think I'm breaking the latter advice all the time though.
- There are some OpenMW related standards, and it helps to stick with them. Try to understand why OpenMW coding standards are as they are.
- Ask help, there are skilled people around, and many are willing to help. There are some people who really know their stuff, then there are people like me, who might want to help, but have limited understanding, and then there are all other sorts of people too.
- Albeit there might be better options, I like to use std::cout all the time to check statuses and values of various variables. C++ variable types and their interactions, pointers, references, casting types etc. can get complex. Nobody gave me this advice, but it has helped me personally a lot.
- Learn the basics of keywords: pointer, reference, casting... also, operators. You don't have to learn all of them at once though.
- For C++, I think that reading about "Rule of Three", "Rule of Five" and "Rule of Zero" has increased my understanding of memory management. Learn at least first what's a class constructor and class destructor.
- Whenever using some set of libraries (Qt for example), read the docs, and pay attention to memory management. Many frameworks tend to do automatic memory management too, so you don't have to write malloc/free or new/delete all the time after all.
- I like to use Atom to code. There are other options, can't really say why one is above other, but personally I like Atom because it's free, clear and simple to use, it feels intuitive, and there are advanced features under the hood, but still not cluttered, and it works straight out of the box - you get to code straight away (you don't have to do any extensive setup on coding software).