Just found this new subforum with nothing in it. Took the opportunity to start a thread about my favourite programming language, https://rust-lang.org It's a systems language, similar to C, but with more safety guarantees and modern features like iterators. It's slowly being adopted in the embedded landscape as well. Ask Me Anything.
Ask Me Anything.OK
How long have we got until the next ELE?
Which microcontrollers have compilers?
Please, give some examples of the safety guarantees.
.
.
It's slowly being adopted in the embedded landscape as well.
.
.
It's slowly being adopted in the embedded landscape as well.
Really? Then I must have been sleeping too much as I have not exactly stumbled upon that (unless "slowly" is to be taken VERY literally)...
Please, give some examples of the safety guarantees.Rust prevents common errors such as buffer overflows and data races statically at compile time.
Please, give some examples of the safety guarantees.Rust prevents common errors such as buffer overflows and data races statically at compile time.
Some types of races, at least. But you can't make things foolproof, since fools are so damn ingenious. The Dunning-Kruger syndrome is very evident in programming.
yes, it was so bad that we had software monitoring software.
Please, give some examples of the safety guarantees.Rust prevents common errors such as buffer overflows and data races statically at compile time.
Some types of races, at least. But you can't make things foolproof, since fools are so damn ingenious. The Dunning-Kruger syndrome is very evident in programming.
There's no substitute for understanding programming paradigms and actually designing a program instead of just slapping code together. The last 20 years of my career I was responsible for writing, and later for analyzing a lot of third-party web code and the process seemed to be "let newly-fledged Java coders write huge apps and hope for the best". They apparently assumed Java's garbage collection and libraries were going to prevent them from doing anything bad, with the result that garbage collection and mismanaged libraries caused problems by the score. We actually were recommending suites of monitoring software to watch the behavior of all this bloated, misdesigned code - yes, it was so bad that we had software monitoring software.
In contrast, during my prior job we had to write a very large embedded program without the "help" of object-oriented languages and their concomitant structures. We actually prepared a series of templates and processes, analyzed the pseudocode before writing the functional version, and stepped through the result before committing it to the compiler. Lots more work than just coding and debugging, but I'm convinced it saved us a lot of effort and the code was highly reliable (it was a realtime system for aircraft avionics; not vital to the flight system, but important to the end user).
I'm just beginning to explore Rust and Go, but they do seem to be designed so that intelligently-written code is much better behaved than with monstrosities like C++ and Java. Of course you'll be able to write crap with any of them, but these languages, at least, seem to be built to provide more capability and make better software possible instead of effortful. I'm hopeful that with the attention (e.g.) Rust is receiving, it may displace a lot of the junk and encourage coders to think and design instead of just following the received wisdom of a failed generation of software implementation.
No, the specific problems are not linked directly to OOP/GC, but the fact that universities and employers push languages like Java without teaching the coders how to actually design programs first does cause that type of problem. It's so easy to make a gargantuan dogpile in Java or C++ that unless the coders actually blocked it out and analyzed it, they're likely to just cause problem after problem when they add more code to address the symptoms.
The "memory leak" issue comes from people writing spaghetti code or using libraries with unintended side effects, and not caring or knowing that they have to be aware of memory usage in spite of GC. Many of the problems we saw in production were the GC kicking in at a very bad time and grinding the programs to a halt because the programmers didn't bother to understand or stress test the code before submitting it to production. Everything to do with bad design and very little to do with the language - except that Java and its ilk are not taught along with proper design techniques (at least among the programmers we worked with at AT&T). I tended to write procedural Java (much despised by "real" OO programmers) but because I knew where memory was being used and for what, my code didn't have those issues; it may have run a bit slower at a guess, but it never crashed.

So my point was that languages like Java and C++ typically exhibit issues because the programmers aren't taught good techniques, and those languages are likely to be used a lot by inexperienced programmers IME who are too lazy to code wisely. They're also hard to use efficiently by fledgling programmers. Heck, I used Java for 16 years and never got familiar enough with it to be aware of all the pitfalls. C, on the other hand, is so easy to master that I think I understood it fairly well.
I haven't tossed my hat in the Rust or Go rings yet, but I'm watching to see if they do indeed exhibit advances which make them worth adopting. If so, then great.

Trying to keep up with a language under development is just an exercise in frustration (and means that a project you finished last year likely does not build with this years toolchain)
C for all its warts (and numerous implementation or undefined behaviour traps) is at least reasonably prone to maintain backwards compatibility, and you can, if you really know the language, do a surprising amount that is very likely to still compile reasonably cleanly 10 years from now, I am not so sure this applies to rust.
Trying to keep up with a language under development is just an exercise in frustration (and means that a project you finished last year likely does not build with this years toolchain)
C for all its warts (and numerous implementation or undefined behaviour traps) is at least reasonably prone to maintain backwards compatibility, and you can, if you really know the language, do a surprising amount that is very likely to still compile reasonably cleanly 10 years from now, I am not so sure this applies to rust.
I've heard that there are applications which are Rust version specific, which is another reason I'm not going to dive in right now. It's already beyond acceptable that finished applications require specific (not minimum) Java versions to run; if a 25 year old language is that unstable (or your app is so poorly written), maybe consider a different language? I would anyway, but then Java doesn't do anything I need in a language that (say) Python doesn' t have.
People moan about the "modern" language features that C is missing, but it is a low level language and wasn't designed to be the answer to all things. I'm glad to see that it has remained its economical architecture even as bloat infests the popular languages; a lot of the embedded micro chips still use C development tools because it's a time-tested and efficient language.
C, on the other hand, is so easy to master that I think I understood it fairly well.
- To me it is remarkably that Hans Boehm even had to write a paper pointing that out: http://hboehm.info/misc_slides/pldi05_threads.pdf "Threads Cannot be Implemented as a Library"
C, on the other hand, is so easy to master that I think I understood it fairly well.
Mastering it of course does not allow any non trivial project with more than one programmer to avoid buffer overflows and use after free, they are defacto language features ... not bugs.
Just found this new subforum with nothing in it. Took the opportunity to start a thread about my favourite programming language, https://rust-lang.org It's a systems language, similar to C, but with more safety guarantees and modern features like iterators. It's slowly being adopted in the embedded landscape as well. Ask Me Anything.

