5 ms·
As a newbie into programming, I get pulled all the time by people to learn my first compiled language either in C++ or Rust. Every time I ask even the most inno
by spaniard89277 4y ago
As a newbie into programming, I get pulled all the time by people to learn my first compiled language either in C++ or Rust. Every time I ask even the most innocent question in any forum it becomes a shitshow, and I can see, I'm late to the party here in HN.
- boppo1 4y agoI'm just a little further down the road than you are and the best course seems to be to learn a little C++ first because it will help inform why Rust works as it does. Then when you try Rust, if you hate it, you've still got C++.
- aliqot 4y agoWe'll be waiting for you on the Zig side :>
- galangalalgol 4y agoI like zig, the simplicity, and explicitness especially, the meta programming is really cool, but having now experienced the borrow-checker, I don't think I'd ever want to program without one. Rust isn't simple, and on occasion, it isn't sufficiently explicit for me, but it has a borrow-checker. For those reasons I'm very excited about Austral. The borrows, linear types, and the notion that anything that isn't explicit is wrong, all appeal to me.
- aliqot 4y agoNothing wrong with that, besides I think the people that only stick with one language are rare these days. It was more humor than anything, and I agree with you. I spent the last year or year and a half or so using Rust quite a bit more than I'd originally anticipated, and it's been cool in a sudoku way that tests my chin scratching abilities from time to time..
- Klonoar 4y agoI used to agree with this, but I would actually now suggest doing the inverse. Rust will beat you over the head with a way of thinking that carries nicely back to C++, and the tooling (Cargo, etc) is more comparable to what someone coming from another language ecosystem would know. Smaller things like Rust's decent support for functional programming seems to click with everyone I know who's dabbling from the JS world.
- allisdust 4y agoAnother way to put it is: Rust is world's best c/c++ teacher. Once you understand and surpass borrow checker, your c++ code will be much less error prone.
- mk89 4y agoLearn whatever you really want to. They are just 2 tools, and either of them will teach you something. You can't make any mistake, if your plan is to learn and maybe build something simple. If you want career advice, that's where things might get a little bit religious...
- HideousKojima 4y agoPersonally I'd say that unless you're going into game dev where C++ is still widely used (or you want to work on legacy codebases that are in C++), learn Rust instead. Or even learn C rather than C++. C++ has a huge gap between the modern and proper way to do things and the old footgun-riddled way of doing things, and it's just a mess.
- yeputons 4y agoPlease do not start with either C++ or C. They are horrible, horrible languages to learn as a beginner. Not because of bad tooling, incompatible compilers, tons of features, or even manual memory management and pointers, no. Two words: undefined behavior. In other languages, if you do a mistake, something fails around the place where you did it, or at least afterwards, or at least you can reason why the failure is exactly where it is. In C++, you cannot. Accidental array bounds overflow? Too bad, now your program crashes in a completely unrelated closing bracket (not even a statement) five minutes later. In other languages, if your program does not crash and produces a correct answer until point X, you can be more or less sure that everything afterwards at least gets corrects inputs. Not in C or C++: if there was an UB before point X, the program may look like it does random things: some stuff is printing, some stuff is shown in the debugger, random lines are executed, arithmetic operations make no sense, perfectly valid functions crash: https://stackoverflow.com/questions/54120862/does-the-c-standard-allow-for-an-uninitialized-bool-to-crash-a-program https://stackoverflow.com/questions/54120862/does-the-c-stan...
- blub 4y agoPeople grow by challenging themselves and this certainly applies to programming. One can’t use training wheels and expect to become skilled at system programming. I learned C++ as an absolute beginner in school back when most memory debugging tools didn’t even exist. Undefined behavior was just another bug that one learned to fix and most of the time it was nothing more exciting than a crash. Being disciplined avoided the problem in the first place… People really have a tendency to dramatize C++. Yes, memory errors are a significant problem for people writing operating systems or browsers that get attacked all the time. For a beginner C++ can be much more fun and instructive than any so-called safe alternative.
- yeputons 4y agoAbsolutely, but it's much easier to understand arrays, strings, functions, loops and structs as high-level concepts first, and continue to manual memory management and UB only afterwards, rather than trying to do everything at the same time. C++ is fun for sure, it was (and is) fun for me, but it's a very specific kind of fun.
- eyegor 4y agoIf you're really new, I'd say either python or c# (unless you have a goal in mind). C++ and rust are both a lot more difficult to learn if you don't have any background imo. The scoping and memory management rules will distract you from learning the basics. Something like python with jupyter notebooks is pretty much perfect for learning or putting together quick projects, and c# to me feels like a more forgiving c++ with a less crufty stdlib. Plus rusts strict memory management rules don't really translate to other languages, and c++ has a habit of changing wildly. The c++ of 10 years ago barely looks the same whereas python and c# feel less like the goalposts are moving.
- spaniard89277 4y agoI'm already fairly deep into python, kinda knowledgeable in JS to make some minor stuff and currently I'm practicing a lot with git. After than it comes Java (i'm following a self-paced bootcamp path). Java seems interesting from an employment perspective, but the small stuff I've touched seems extremely verbose. I feel like I have to write and think way more to do simple stuff. But I just had a brief introduction, I guess I can get used to it. I wanted a compiled language that allows me to tackle some interests I have, and I feel It will be c/c++ wether I like or not, because one of my interests is fiddling with hardware. Nim can compile down do C apparently but it isn't widely adopted.
- eyegor 4y agoThe reason I mentioned c# is because it feels like "if Java adopted new features at a decent rate" and these days pretty much all of it is MIT licensed. Coming from Java to c#, I found it much more ergonomic and productive mostly due to less boilerplate and more concise syntax sugar. There are several ways to compile it to native if you need to and it has great c/c++ ffi support, although if you're doing a lot with microcontrollers you'll end up writing c/c++ eventually. Luckily a lot of big langs (c/c++/c#/Java) have similar syntax and concepts since they all sort of started from c. I'd suggest waiting until you learn some java/c# before starting on c/c++, or instead starting at old school c (k&r c) or arduino c++. Modern c++ is a beast to learn.
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- blub 4y agoMost Rust stuff is just rewrites, crypto or some specific tool that some corporation or start-up needs. C++ is one of those languages that people write anything and everything in. Whatever you need, whatever you’re curious about, it’s likely out there. As for what it feels like, if you want safe but boring, go with Rust. If you want exciting go with C++. Personally I’d never start with Rust, it’s like biking everywhere with training wheels.
- aldanor 4y agoThanks for the laugh :)