this post was submitted on 04 Aug 2023
175 points (94.0% liked)
Programming
17373 readers
187 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Different programming languages have different types of strengths. C is good for bare-metal performance and hardware interactions, Python is good at versatile interactions with all kinds of software and systems, Node.JS is good for asynchronous operations, and so on. Some esoteric languages aim to make things easy (or make them possible in the first place), or make things faster, or more secure, or etc. The things you can write in one language don't always translate to another, and sometimes people create a new language that makes things possible that didn't used to be possible. Machine learning wouldn't be where it is if everyone who's currently using Pytorch was still using C and doing all their own memory management. I'm currently working on a project in Node that would be much more difficult in Java, because Node's approach to asynchronous operations matches this problem way better than do the primitives that Java's runtime makes available. And so on.
Is any given language that gets created going to be the next Python? Probably not. But everyone who makes one has some kind of idea that there's something unique and wonderful within it, and you can't tell if they're right unless you let it happen and see how it plays out.
Edit: Okay lemme clarify: Node.JS is good for a particular type of (generally I/O bound) asynchronous operations. It makes simple things easy and fast, at the cost of making some complex things pretty much impossible, so there are a bunch of problems it's not good for. Better with the caveat maybe?
If you have time (and the inclination!), would you mind explaining why Java's primitives aren't as good as Node visa vie Async ops?
There isn't one, java is excellent for async and multithreading and it does it properly unlike node that fakes it by running on a single clever event loop or stealthily launches a bunch of node instances in the background depending on implementation.
I talked up above about my feelings on it -- I did Java and J2EE programming for years back in the day, so I'm well familiar with Java and its very real strengths and very real weaknesses. There's good and bad to the many-threads-in-a-process approach, and to the one-process-per-task approach, and to the one-thread-with-async approach. If what you're looking for is many-threads-in-a-process, then yes, Java does it right. But if you're looking for something else, maybe it's going to be wrong. It just depends.
Also can you explain a little more about the implementation that stealthily launches a bunch of node instances in the background?
My bad, I was mostly curious about how it matched OP's project better and why.
When you say it does it properly, do you mean actually creating proper threads or something else?