Rust isn't that hard to learn. I teach it to college sophomores who only know Java, and within 2-3 months I have them writing parsers and interpreters in Rust. In fact these students are requesting our courses to be taught in Rust, and have never heard of Zig.
I think that while the language is a little complicated, this is tempered by how nice the tooling is. I consider the borrow checker to be my TA, as it actually helps the student write code that is structured better. When they go on to write C and C++ in later courses, their code is actually more memory safe due to having their habits having been shaped by Rust.
It's fairly mixed. Compiler warnings and errors are great. IDE integration is improving. CPU profiling with perf/hotspot is fine, albeit memory-hungry. Debugging and memory profiling is still bad compared to java.
That's nice, at UPB in Bucharest we use for the OS course C and for the distributed systems one Go/Java, though the DS one involves heavy theory/math and less coding but implementations in Go/Java are a big bonus. I don't know where do you teach, but our students would probably be confused by Rust and their time will be spent elsewhere instead of being focused on the actual course content.
Possibly but Python is a completely different level of programming too.
I do wonder if Rust is easier or harder than other comparable languages like C / C++ when the person has no prior knowledge of programming.
I would say just the ease of having a hello world and the ease of the Rust book would make it easier to get to grips with. No dealing with complex build systems and compiler flags at the start
> I do wonder if Rust is easier or harder than other comparable languages like C / C++ when the person has no prior knowledge of programming.
I can answer this because I previously taught the course in C and C++. The students supposedly have some knowledge of Java but they seem to always have forgotten all of it when they reach me.
Students learning C use all of the footguns you can imagine. The biggest problem for them is writing code that segfaults, and their code always segfaults. It's not so much a problem that it does, but that there is 0 useful feedback as to why the segfault occurred and where they could potentially look to fix the problem. The bigger issue for them is memory management. They frequently walk into the use after free, double free, and memory leak walls. They also have significant trouble with N-dimensional pointer arrays. They have trouble allocating the appropriate memory for these arrays and can't seem to visualize the layout of memory.
C++ is a little better because they have experience with Java, but they are frequently mystified by constructors/destructors and how to manage memory manually (they only have experience with a GC), and template programming is always an issue. But they still run into the same issue with segfaults.
Rust makes all of this go away. They don't have to manage their memory manually, and they don't encounter a single segfault. Ever. We are able to just sweep all of those problems under the rug, and move on to actual content. With C/C++ we focused a lot on the language with the hope we could use it as a tool eventually, with Rust we use the language as a tool and focus on the wider world of applications for which that tool is useful.
You are doing it wrong If you are manually managing memory on Modern C++.
C++ has RAII built in even before Rust came to the scene.
I've never had a situation where I had to manage memory manually during my professional career in C++
If your students face seg faults, please show them Valgrind. Valgrind is better than GDB when it comes to seg faults. It can show you where exactly error occurred.
Edit: Oh I got downvoted for saying truth. I now know what they are really up to.
You still need to teach what the delete keyword is and how memory management works in C++. There's tons of code out there not written with smart pointers.
And yes we use valgrind, but it's important not to overload students who are new to programming. Students tend to reach for withdrawal forms when you tell them "I see you are overwhelmed by this new tool you're learning. To solve this problem here's a new tool to learn". The near-universal sentiment I've gotten from students going from C/C++ to Rust is "Wow, this is so much nicer". YMMV.
Depending on what kind of work you do, you may not have a choice as to whether you get to you smart pointers or not. Our students go into work with decades-old codebases littered with new and delete. They need to know what they do.
> You claimed that you don't have to teach Manual Memory management in Rust so why not do the same for C++?
Because there are no old rust codebases where manual memory management is an issue.
I haven't seen a 'new' or 'delete' in C++ in 15 years. (And I have worked on teams writing custom malloc implementations and lots of other low-level things.)
I guess there are lots of demented and broken codebases out there, but starting students with the broken dysfunctional case as the default seems wrong. They can learn bad habits on their own later.
I have worked with decades old codebases. I use up-to-date compiler where you get to use smart pointers and all the Modern C++ features. It's your fault if you not teach them how to upgrade the compiler. There is zero risk when compiling C++98 with C++11.
It's also student fault if he selects a company with C++98 codebase. The student shall do due diligence.
It's my advice for you to teach the Modern C++ before driving into legacy C++ sort of like how you teach History. You start what's current then drive deep under.
Ok. I'll take your advice and give it the consideration which it's due. Thanks for taking the time out of your day to create a throwaway account just to tell me how to do my job. Cheers.
Unfortunately, the C ++ Committee knows that universities do a terrible job teaching C ++, except the one Bjarne teaches. If you ask Bjarne, he will tell you the same things I said.
A lot of universities stuck in C++98. It will takes them 1000 years to adopt C++20 tho.
One of mistakes many universities do is teaching either C or Java before C++.
I find C++ as a minimal OOP language to get head start.
C++ -> Java
-> C
But if student is a complete noob to programming, I'd suggest to learn Javascript before going to C++
Again, this is to keep the intuition otherwise they will forget what they learnt.
I wish if many universities listened to Kate Gregory talk.
When you teach Java before C++,
Students try to write C++ in Java Style (Eg with new and delete). I answer plenty questions of students on Reddit's cpp sub who are trying to write C++ in Java style. I might make a talk on this in CPPCon.
When you teach C before C++,
Students try to write C with Classes.
But, as once Steve Jobs said,
"I used to think that technology could help education. I’ve probably spearheaded giving away more computer equipment to schools than anybody else on the planet. But I’ve had to come to the inevitable conclusion that the problem is not one that technology can hope to solve. What’s wrong with education cannot be fixed with technology. No amount of technology will make a dent."
You can laugh at me, that's okay. But truth is truth!
By the way, This is my 50th throwaway account. I use them because I'm getting down voted to death when speaking in defense of C++.
I was blessed that my own university during the early 90's, already teached C++ after Pascal to first year students, C was never taught explicily and naturally Java was like 6 years away to be a reality.
The same univerity does teach modern C++ nowadays.
Have you coded on larger code bases not written by you? Usually most of the time you read code instead of writing it. Sure you can add new code that adds smart pointers, but you still have to understand the exant code, at least to some degree.
I've done plenty contractual work on larger code bases that has C++98 to some extent. I will tell you what you will never truly understand the whole code base.
Sourcetrail does amazing job at explaining larger code bases. Check it out.
My experience with C++ is that every time I look at it every few years, C++ developers tell me that I'm stupid for wanting to do memory management the way it was done a few years ago and nobody has ever done that.
No. A lot of job posts out there that highlights the language version. For example, I saw a lot of job posts for C++11, C++17 so on. Heck even, some jobs directly mentions Modern C++.
> I've never had a situation where I had to manage memory manually during my professional career in C++
I don't know what kind of career you had but it's nothing like any C++ career I've ever heard of. Do you never allocate integers or other basic types on the heap? Do you never deal with C-strings? Do you never interact with C libraries? Do you never call posix functions?
A C++ career is full of memory management. You got downvoted because it appears you're speaking from a lack of experience. Even if what you're saying is the truth, I would say you fell into a lucky niche that is unusual compared to the average C++ programmer.
"C++ is a little better because they have experience with Java, but they are frequently mystified by constructors/destructors and how to manage memory manually"
The Rust book as currently written assumes that the user has some programming experience. That's mainly b/c there hasn't been much of any experimentation in teaching Rust as a first time programming language. Although obviously it's been done for C++ and even C, so it ought to be quite doable, if perhaps with a bit of a "learn programming the hard way" style.
Python is way too ad-hoc to be a good teaching language in a professional context. It's designed to teach kids and first-time coders, as an alternative to BASIC.
I think that wholly depends on the context. Python is a great teaching language IMHO if the goal is to teach how to get things done. It's not a good language if you're teaching how things do work under the hood.
To me it's the difference between programming and computer science.
I think that while the language is a little complicated, this is tempered by how nice the tooling is. I consider the borrow checker to be my TA, as it actually helps the student write code that is structured better. When they go on to write C and C++ in later courses, their code is actually more memory safe due to having their habits having been shaped by Rust.