Recently I've fallen out of love with Perl as a cross-platform general purpose scripting language, and niether Python nor Ruby ever really appealed to me either.
But I've been getting more and more comfortable with JavaScript in the browser, it's getting pretty good performance in contemporary engines such as V8, and node.js has been really taking off for a couple of years now.
But node.js is intended for server side networking programming primarily. As it declares itself on its homepage:
Event-driven I/O server-side JavaScript environment based on V8.
I would like to know if node.js is also currently suitable as a general scripting language on *nix and Windows as an alternative to Perl, Python, and Ruby.
I don't find much talk of it being used in this way yet it does seem to have a broad community and I haven't noticed anything saying it's not suitable for this use. Is it widely used this way? Or does it lack key features or modules for this type of thing?
No, because Node. js works with JavaScript, and Python has CPython.
In a nutshell, Node. js is a popular programming environment that can be used for building high-scale applications that need to support multiple concurrent requests. Single-threaded non-blocking I/O makes it an excellent choice for both real-time and data streaming applications, too.
Node is better for web applications and website development whereas Python is best suitable for back-end applications, numerical computations and machine learning. Nodejs utilize JavaScript interpreter whereas Python uses CPython as an interpreter.
In terms of Node.js, I can't see it becoming a mainstream way of using javascript as a general purpose scripting language. The main reason for that would be the async nature of 99% of the libraries and functions available in Node.js. Because of the async nature, you have to completely change your thinking. Not having synchronous methods available is the stumbling block. It makes things less script like as your code is not linear anymore.
So the adoption is not happening for the simple reason that most of the time you're thinking: I could write this a lot quicker/simpler in Ruby/Python/... (just try downloading 5 different files, zipping them and copying them to another folder using Node.js)
As people get more used to thinking and programming in an async way adoption of node.js as a general purpose scripting tool might change.
If every async function in node had a synchronous version, adoption would have been different and people would have ended up with non scalable node.js servers because they choose to use sync methods in places. Arguably, node would not have become popular as the performance numbers wouldn't have made it stand out.
In short:
adoption of node.js is happening because of it's async nature. adoption of node.js as a client side general purpose scripting tool is not happening due it's lack of synchronous functions.
Please keep in mind that this is based on my own experience and opinion and not on articles or numbers I found on the internet so try it out for yourself and make up your own opinion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With