(Re)learning to program [C++, C# or Rust]?
Good evening,
I already have some experience in programming, mainly C# and C++, although I'm a bit rusty in both (probably a bit more skilled in C++, but generally an amateur).
Now I'd like to get back into it, but I'm not sure which language I want to focus on. I think it's definitely a good idea to focus on just one language for now. Besides, my previous knowledge doesn't really play a role in the selection, and potential job prospects (how frequently the language is used in business) are at least somewhat secondary.
I'm pretty unsure, especially because I don't really know what I want to program (not even the general direction).
On the one hand, I think C# is easy to learn; you achieve success quickly and can develop desktop software well, but it is a bit slower and you probably learn less about the inner workings of the PC.
I generally quite like C++, at least from the relatively limited experience I've had with it. It's performant, you learn a lot about the deeper concepts, and it's good for embedded development (I still have a few STM32s with which I already have some experience in combination with C++ and which I might want to do something with in the future). On the other hand, a lot of things in C++ seem to be a pain, and few people like it.
Rust often receives high praise, and it sounds really interesting to me. However, I'm still unsure because I don't really know the use cases, and the language isn't really OOP (as far as I know). Embedded programming is possible, but I think the support, especially for beginners, is much better in C++.
In short: I'm clueless and would appreciate some more experienced programmers helping me make my choice. Other suggestions are also welcome, of course (although I'm less interested in Python).
Thank you in advance!
C# itself is less suitable in depth, but it is well suited for the safe learning of a programming language. Unlike some deep language (such as C++), C# provides security that is just useful as a beginner. Slow is relative. In C# you can use pointers, chips and other ways to make your application quite fast. It will not reach the speed of C++, but you can get a lot out of C#.
C++ is a heavy language, can do much for it. The transition from C# to C++ is not even so difficult. With C++, you really have to consider extremely much while all this in C# is removed from the GC (for example). I don’t know your strengths, but if you say you’ve been out for a long time and you want to learn a lot, then C# sounds for a better choice, with a later transition to C++.
It’s the opposite. While C++ can be very unsure and thus “prone”, Rust already offers built-in mechanisms that allow beginners to write a secure code. You must not always assume that a language that looks simple is also simple. There is much more to consider. If I had to choose between C++ and Rust for a beginner, I would probably recommend Rust.
Again summarized:C# is a great language. It can do much what C++ can and you can gain a lot of understanding. You can also learn to understand the RAM (heap, stack, pointer, …). C# is very powerful. It is sometimes possible to compile C# natively. This makes the program even faster. Since I read out that you seem to be very interested in C++, I can really recommend C# (but not only the basics, but also the deeper things). If you’ve learned this, you’ll have it much easier when you get into C++ and the path of learning also happens safer, as C++ hides dangers at many places that you have to solve yourself while C# takes away all this.
This is my opinion and experience. Other opinions may vary, of course.
Thank you very much, you’ve helped me.
I fully agree with you, in general my choice would only fall to C# (even if I described it above as a little slower than C++ & Rust, that would not be a concern for me at all). The only thing that makes me doubt is that I’m closing the possibility of developing embedded (which is also the case with Rust, if possible). I don’t have to write directly in front of embedded software, but you would have liked the option. In addition, I would probably be forced to use Visual Studio (?), but I would prefer to work with neovim, which is of course a luxury problem :’)
With C++ I have the most experience in general and the only experience in the embedded area. With basic concepts such as pointers and memory allocation I do not really have problems, but as you have already said, it is not the best choice for beginners, has a slower learning process and something insecure / invite to errors.
Rust is just interesting and I would generally like to learn it. Embedded is generally possible, but it was already possible to develop a ramp code for an STM32 outside the STM32CubeIDE with C++. Since finding a proper solution and additionally enough learning content is probably too much of the good.
I think I just sleep over one night, see if at least the smaller problem (Visual Studio instead of nvim) can somehow be solved halfway, consider which projects I want to tackle at all and then I make a decision.
Thanks again!
C# can be used in any ide or editor. Even in Windows notepad. The compiler is available as cmd tool.
Yeah, C# doesn’t like it, but it’s about learning. If you can C#, the transition to C++ is much easier and you already have the most knowledge. Going around always goes.
Visual Studio is not a problem. There are also raiders from Jet Brains, Visual Studio Code, notepad++, and many more
Thank you.