As an embedded dev, good luck not using C
Programmer Humor
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
Not an embedded dev. What's the Rust situation in the embedded world? Is it ever used?
Embedded devs have heavy gambling addiction apparently
Nonsense. If your code has reached the point of unmaintainable complexity, then blame the author, not the language.
I feel like there's about one person that can cast this stone, and that's because preventing this has turns Torvalds into an abusive bridge troll sometimes, but he's actually been successful.
Well, the kernel is unmaintainably complex. Linux saves his sanity by not looking deeply into modules and only inspecting the surfaces.
lol. Typescript isn’t actually type safe.
Yes it is? It isn't strictly sound, but it is type-safe aside from explicit escape hatches (which other type-safe languages also provide).
Explain or be downvoted
Python isn't "untyped;" it is, in fact, strongly-typed. (And is markedly different than and superior to JavaScript on that point.)
This rant feels like it was written by an OO programmer who was never able to wrap his head around functional programming.
It's also dynamically typed and inferior to TypeScript.
Do you mean python has something to do with functional programming, or did I misread? Because I would say e.g. Typescript is (slightly) closer to FP than Python.
Yeah, plus it has type hints and tooling to make said type hints mandatory.
Also, like, fuck golang, it's such a shit language and the compiler does very little to protect you. I'd say that mypy does a better job of giving you AOT protection.
It took me a whole some text by compiler was supposed to be an error message, there were not any saying of any kind error or hints that it was in fact an error. It just printed some packages then exits with non-zero code.
Turns out it was import cycle.
Also, like, fuck golang, it’s such a shit language and the compiler does very little to protect you
I never understood why people like it. It's a "new" language, and it still doesn't seem to get the basics right. No proper null handling, and don't get me started on interface{}. It's like they set out to build a better alternative to C++ while ignoring the other developments outside C/C++ for the past 15 years. The compiler is damn quick, though.
I've dumped 18 years of C++ experience for Go in 2018, and never wanted to come back. Took me a couple of months to become accustomed.
The main Go's feature is a green light for ignoring OOP baggage collected for decades, which makes writing code unnecessary burden. And Go have tools for not doing that.
Yes, sometimes it can be a bit ugly, but if you're ready to trade academic impeccability for ease of use, it's a real blast.
I've seen a lot of bad code in Go, which tried to do OOP things taught in school or books. Just don't. Go requires a different approach, different mindset. Then everything falls in their places.
"Blame the author, not the language"
Says the person who screams they have never worked professionally with a team before.
There is no excuse to not use statically typed, safe languages nowadays. There are languages that let you build faster like Python and Typescript, but faster does not mean safer. Even if your code is flawless it still isn't safe because all it takes is a single flawed line of code. The more bug vectors you remove the better the language is.
let you build faster like Python
I have to write so much boilerplate code to make sure my objects are of the correct type and have the required attributes! Every time I write an extension for Blender that uses context access, I have to make sure that the context is correct, that the context has the proper accessor attributes (which may not be present in some contexts), that the active datablock is not None, that the active datablock's data type (with respect to Blender, not Python) is correct, that the active datablock's data is not None... either all that or let the exception fall through the stack and catch it at the last moment with a bare except and a generic error message.
I used to think that static typing was an obstacle. Now I'm burning in the isinstance/hasattr/getattr/setattr hell.
I have to write so much boilerplate code to make sure my objects are of the correct type and have the required attributes!
That is the trap that, sadly, my company fell for too. The POC was written in python. very fast i might add. but it was only that: a POC. if the whole backend crashes due to unexpected user input - noone cared. if the frontend displayed gibberish because the JSON made wrong assumptions about not defined data types - sweep it under the rug, don't do that during presentations.
but if it came to building a resilient system, which can be shipped to customers and preferably maintained by them (with minimal consulting contract for access to our guys)... we cursed the way python worked.
I loved python when I was a junior dev. Now I hate it (except for things like computational math). I have to add debug statements to figure out that someone snuck in the wrong type into the code.
Even if your code is flawless it still isn’t safe because all it takes is a single flawed line of code.
If there is a single flawed line of code, the code isn't flawless.
Even if the code is flawless now, all it takes is a single flawed line of new code. This is of course true for all languages, but type safety helps a lot as some types of flaws would not compile.
In my 15+ years of experience many of the actual field problems are not language / programming related at all. Unclear requirements or clear but stupid requirements cause loads of issues. These are often caused by communication problems between people and / or organizational issues.
It depends a lot on the industry of course. For embedded software, low level networking etc I mostly agree with you. However, in business applications or desktop applications it's from my experience mostly bad requirements / communication.
Don't forget to add incompetent leadership to that list. If feature needs to be shipped by some arbitrary deadline and the engineers are forced to rush through the design process, you end up with a patchwork hack of tech debt that leads to more tech debt.
There are definitely use cases where something like C is still the best option because it's faster. For the most part consumer software it's unnecessary, but it's not obsolete for all applications.
Hell, assembly code is still necessary for the lowest-level init code. Once you have a functional stack and some var init logic you can graduate to C.
A little hair-splicy, but an assembly-free bootloader is definitely doable on some platforms -- Cortex-M processors load the stack pointer from the vector table, and the initialized memory setup can be taken care of with memcpy.
True, but you're not gonna be setting the access levels or doing anything else with control registers on a Correx-M in pure C, let alone boot to a safe state with zeroed registers.
That's ridiculous. Everyone knows its best to write modern bootloaders in Matlab.
You joke, but my first "lets make facebook, but..." comment was from an electrical engineer buddy that wanted to use matlab. That was the whole pitch. "Facebook, but matlab."
It did not go far.
I'm not even going to bother commenting on that train wreck of a post, but I just wanted to mention that I hate the writing style of programming-related LinkedIn posts. They're just chock-full of sweeping generalizations presented as absolute truth in an extremely patronizing tone.
Why can't people just say, "In my opinion, X technology is a better fit for Y situation for Z reason," instead of "Every time you encounter X, you must do Y, otherwise you're dead wrong."
It's just simultaneously so arrogant and also aggressively ignorant. If someone spoke to me like that in real life, I would never want to speak with them again. And these people are broadcasting this shit to their entire professional network.
I agree with the post. Setting up typescript takes an hour or two if you have no clue what you’re doing. In return you get the absence of (the equivalent of) null pointer exceptions.
I chuckle every time I find an NPE in the Java backend. Doesn’t happen to me. Can’t happen to me.
Sidenote, while I’m already gloating: Once the backend code had an error where they were comparing two different kinds of IDs (think, user ID and SSN), which gave wrong results. This error can’t happen to me either, because I type my IDs such that they are not comparable. A strong type system really is a godsend.
NPEs are the reason why my team moved to Kotlin. Well, that and all the other myriad advantages Kotlin brings to the table.
One of the backend devs started using Kotlin. From time to time I need to read backend code, and I have to say it’s very easy to write an incomprehensible mess in Kotlin.
Kotlin isn't perfect and it gives the devs quite a lot of freedom. I would argue that if your Kotlin code is messy, that's on you - but it will still be significantly less prone to failures like NPEs. Unless you opt out of null safety by using the dreaded ?-Operator.
I really like how I can turn everything into immutable val's and represent different paths as expressions, it can IMO really reduce the complexity of a function and makes it easier to spot bugs.
I've been migrating some code of a FOSS app to Kotlin and was able to shrink most classes by like 30% while making it easier to read. The only thing I dislike about it is the additional syntax for various things, I could do without having multiple ways to write a constructor.
Yes, there are things about Kotlin I don't love either. But I still like how it was clearly developed having developer quality-of-life in mind.
Setting up typescript takes an hour or two if you have no clue what you’re doing
Modern versions of Node.js have native TypeScript support. For scripts, you can just write the script then run it. That's it. No build process needed. A beginner could just rely on type checking in their editor (I think VS Code has the TypeScript tooling installed by default?)
For web apps, just use something like Bun or Deno. Bun gives you practically all the tooling you'd need (JS runtime, TypeScript, package manager, test runner, bundler, and framework for building web apps) out-of-the-box. It doesn't have a formatter, but you can just use your editor's formatter.