Learning C++

Not about OpenMW? Just about Morrowind in general? Have some random babble? Kindly direct it here.
unelsson
Posts: 227
Joined: 17 Mar 2018, 14:57

Re: Learning C++

Post by unelsson »

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).
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Learning C++

Post by sirherrbatka »

I think that racket scheme is fairly decent, educational environment. It is interactive, not file oriented, simple, has some useful libs to build practical stuff and decent environment that includes everything you will need to start.
lazyblue
Posts: 1
Joined: 08 Apr 2019, 15:13

Re: Learning C++

Post by lazyblue »

i know c++ up to structure and file input output .. i am reading data structure and algorithms .. then where .. i mean i want to fully contribute to this project so .. what are the tools and topics i should know and what and where or which books i should read .. i get scared by { #define }
i opened a few open source projects and i was totally lost is there any way for me to be an expert and contribute to this project so i can enjoy it .. it is a question i guess for many millons of people .. i want to self taught as much as possible .. so please give me a deep guide .. i can guide a few more people here { .. but they are lost like me .. so plese please please please please help me
User avatar
raevol
Posts: 3093
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Learning C++

Post by raevol »

lazyblue wrote: 08 Apr 2019, 15:34 i know c++ up to structure and file input output .. i am reading data structure and algorithms .. then where .. i mean i want to fully contribute to this project so .. what are the tools and topics i should know and what and where or which books i should read .. i get scared by { #define }
i opened a few open source projects and i was totally lost is there any way for me to be an expert and contribute to this project so i can enjoy it .. it is a question i guess for many millons of people .. i want to self taught as much as possible .. so please give me a deep guide .. i can guide a few more people here { .. but they are lost like me .. so plese please please please please help me
Being able to figure things out on your own is one of the most important skills to have as a programmer, and is absolutely essential to be able to work in open source. I understand the frustration of being lost and confused as a beginner, but there are a ton of resources out there. Even if you don't find exactly the right one the first time, any learning that you do will eventually lead you to the right place.

Sorry if this comes across as harsh, but it's an important lesson to learn. You can do it!
danny95623
Posts: 1
Joined: 01 Sep 2019, 18:37

Re: Learning C++

Post by danny95623 »

I would say "Yes". Our shop is/was a Java shop but I've found that while Java has its place, if you really have to get a job done, we use C++. Basically you can use it for anything from low-level device control to CGI backends.

For some smaller projects where performance doesn't matter you can save some time using a P-language (PHP, Perl, Python) but for the bread-and-butter we use C++ now. Our goal was pure Java but it has turned into such a memory hog with slow startup times. And, unless you use a serial garbage collector and are willing to accept occasional lag times, the memory usage for a long running (manga zuki) process can easily grow to a gig or more. As an example, our web server is written in Java and it easily approaches the 1 gig mark after a few days. You can keep it lower by using a serial GC and free heap limits but then you get lags while the GC is running. The C++ version stays at around 800K and never experiences lags.

So, if you want it to work reliably and efficiently, C++ is the language that is still used and will be for a long time to come.
top10g
Posts: 1
Joined: 12 Nov 2019, 11:31
Location: India
Contact:

Re: Learning C++

Post by top10g »

raevol wrote: 03 Apr 2019, 22:59 Guys, let's not forget that this guy is just starting. Let's not scare him off with decades-old language hatreds.

Basically any commonly used programming language is a good choice to start, as long as you learn the strengths and weaknesses of each language down the road when you are ready to tackle bigger stuff.

Python is a great place to start because of the amazing documentation it has. Sure, it has bizarre quirks once you start getting into more advanced stuff, but so does every language.
What about a complete noob in programming field? I'm just starting!
User avatar
raevol
Posts: 3093
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Learning C++

Post by raevol »

top10g wrote: 12 Nov 2019, 11:40 What about a complete noob in programming field? I'm just starting!
Python!

There's a Python meetup group in my area, depending where you are you may check if there is one near you, but there are so many online resources for it if you are antisocial you will be just fine!
julix
Posts: 2
Joined: 11 Apr 2020, 08:32

Re: Learning C++

Post by julix »

I tend to agree that to learn the thing you're trying to learn - learning that thing tends to help -- maybe start here: https://www.amazon.ca/dp/111882377X

However, my learning experience started with JavaScript in the browser - and I'm not sure I would have fallen in love with programming otherwise. Front-end coding is fun and rewarding because you see the results right away. Downside is in addition to programming concepts you got to wrap your head around browser related stuff, HTML (as far as Document Object Model cares) and such.

If you feel like learning by doing is your style http://codecombat.com/ is a game with RPG elements that you control using code (Python or JS)
It's really guided starts easy (designed for kids) but picks up in pace and taught me a lot about programming early on in a rewarding way.
I'm quite fond of the XP/gems rain after completing a level... and buying new gear with new "methods" on the "hero object" :D
1Zero
Posts: 38
Joined: 09 Feb 2020, 18:44

Re: Learning C++

Post by 1Zero »

The language in question isn't so important. The underlying principles are independent of the used programming language, as long as it is turing complete. Algorithms, data structures, programming paradigms (and optimally formal proof methods) are always to be kept in minds. It's generally a good idea to keep an eye on arxiv for algorithm research. Some languages are more adapt for one programming paradigm than others - for example logic programming in C would be a lot more tedious than in Prolog.
lepeirsein
Posts: 1
Joined: 30 May 2020, 03:42

Re: Learning C++

Post by lepeirsein »

I am also beginner in C++. Love to learn new stuff.
Post Reply