Live data from Hacker News

JavaScript is Eating the World

dev.to

21–30 of 323 posts

Re: JavaScript is Eating the World

#21

The more time goes by the more I feel crazy for missing whatever would motivate people to use js for anything more than is strictly necessary. Single threaded server??? I mean come on man, I understand you don't need parallelism for a lot of use cases but even if that fits your situation why javascript? It can't be that hard using a different language. I refuse to believe that.

Node is single threaded, in the sense that your code runs in a single thread. Your code assigns microtasks, to be executed later.

Basically, if you write in Node JS, there's no concept of a thread. The thread API is not visible or accessible to the developer.

This forces you to think from the ground up about asynchronous operations that would take some time to complete - file opening, network requests etc., and have you group all tasks dependent on that time-consuming task, separately.

In Node, you are not supposed to block the event-loop that runs in that single thread and queues the tasks.

Node JS has shown over the years that it scales well (maybe not as good as Go or Elixir, but enough for most use-cases).

Node also offers lot of great tools, that can be easily added to your project via NPM / Yarn. The Node ecosystem has a solution for virtually any task you might need to do repeatedly in a project.

Just to be clear, I am not saying Node or its ecosystem is perfect. There's always room for improvement.

What I am saying is that what appears as an obvious flaw, is not really a flaw. The language allows other approaches to solve the problem.

Re: JavaScript is Eating the World

#22

I think a few aspects of the language contribute to this: 1. It is relatively easy to comprehend and pick up and play around with. 2. With the advent of node.js, and later electron, it is incredibly relevant whether you're developing web apps, servers, or now, even desktop apps. 3. Some of the newer features, such as arrow functions actually make writing javascript a lot of fun! JS has come a long way. I do think the…

I agree with most of your points, however regarding ease of learning, I think it's one of the more difficult languages to wrap your head around, specifically when dealing with the Asynchronous nature of it. Majority of languages people encounter do not behave that way by default, and visualizing what function is being called where, and why results happen that you weren't expecting. Can quickly become VERY confusing.

I think it's a totally cool language because of it, but it definitely does not have that ease of use for any sufficiently complex application.

Re: JavaScript is Eating the World

#23
post #3

For anyone who's searching for more quantitative data, there's always the 2017 Stack Overflow Developer Survey [1] which seems to reflect that js (& node) are still growing. [1] https://insights.stackoverflow.com/survey/2017

Yes, in a survey that returned that 72.6% of the respondants consider themselves "web developers", it turns out that Javascript usage is going strong.

It is the opposite result that would be surprising.

Javascript isn't eating the world, it's just escaping from its multi-decade browser-only shackles and spreading its wings, which means JS is moving into some niches it previously had no access to. From 0, there's nowhere to go but up! If you're a primary-JS developer it may feel like suddenly the world is at your command, compared to where you could take your skills before. But it's not eating the world and it's not going to, because there aren't any niches anymore for it to conquer that aren't already colonized by other quite good competition. JS itself is nothing particularly fancy next to Python or Ruby. And there are a lot of very important niches that are simply unavailable to it.

If Javascript were something other than a fairly standard dynamic scripting language, it might find itself with some new opportunities. But it's not, and while it was locked in the browser, the other dynamic scripting languages pretty much took over everything that a dynamic scripting language can. I'm sure JS will develop parallels to some of that stuff, it already has, but it isn't going to be growing into uncontested space.

Re: JavaScript is Eating the World

#24
post #17

The other day I managed to freeze my computer -- such that I did not even have access to the SysReq key, by stupidly running while (true) { var d = new Date; e.textContent = d.toLocaleString(); } I immediately realised my stupidity, and closed the tab. Shortly after, my mouse froze up, then my keyboard access, and eventually my entire access. Rather than just freezing Xorg as I had initially suspected, it froze my en…

I tried your code snippet on my inferior Windows OS and inferior IE Edge browser. The tab stopped functioning. I opened a few other tabs and continued to work. Eventually IE showed a notice that the tab had stopped responding - I had the option to close the tab or recover the webpage. I clicked 'recover webpage', the page was refreshed and I could continue using it. Truly, Javascript is eating the world.

Or perhaps the language has nothing to do with your problem.

Re: JavaScript is Eating the World

#25

I think a few aspects of the language contribute to this: 1. It is relatively easy to comprehend and pick up and play around with. 2. With the advent of node.js, and later electron, it is incredibly relevant whether you're developing web apps, servers, or now, even desktop apps. 3. Some of the newer features, such as arrow functions actually make writing javascript a lot of fun! JS has come a long way. I do think the…

A key point regarding your first item is that it isn't particularly the language that is easy to pick up - it is that its original "native" environment made it very easy to access and play with. People often start with a bit of JS to tart up their web page, then move to making it even more interactive, and once they start wanting server activity there is now the option of not needing to learn another language for that. The single language server and client side is quite a draw, and with some frameworks where your code is running can actually be somewhat obscured so you don't need to care.

Re: JavaScript is Eating the World

#26

I think a few aspects of the language contribute to this: 1. It is relatively easy to comprehend and pick up and play around with. 2. With the advent of node.js, and later electron, it is incredibly relevant whether you're developing web apps, servers, or now, even desktop apps. 3. Some of the newer features, such as arrow functions actually make writing javascript a lot of fun! JS has come a long way. I do think the…

Take away the web platform, would you still use JS for anything ?

Does that really matter? The web is the past, present, and definitely the future. There will be less, and less native apps, and more and more web apps. JS is here to stay, and I'm glad big companies are pouring tons of R&D into making it faster, and easier to use.

Re: JavaScript is Eating the World

#27
post #21

The more time goes by the more I feel crazy for missing whatever would motivate people to use js for anything more than is strictly necessary. Single threaded server??? I mean come on man, I understand you don't need parallelism for a lot of use cases but even if that fits your situation why javascript? It can't be that hard using a different language. I refuse to believe that.

Node is single threaded, in the sense that your code runs in a single thread. Your code assigns microtasks, to be executed later. Basically, if you write in Node JS, there's no concept of a thread. The thread API is not visible or accessible to the developer. This forces you to think from the ground up about asynchronous operations that would take some time to complete - file opening, network requests etc., and have…

> In Node, you are not supposed to block the event-loop that runs in that single thread and queues the tasks.

well, sure, but ten years ago it was already a given that one would just spawn one event loop per thread and have them communicate with messages, so why is it so hard for node ?

Re: JavaScript is Eating the World

#28

The more time goes by the more I feel crazy for missing whatever would motivate people to use js for anything more than is strictly necessary. Single threaded server??? I mean come on man, I understand you don't need parallelism for a lot of use cases but even if that fits your situation why javascript? It can't be that hard using a different language. I refuse to believe that.

Javascript as a language and ecosystem has evolved quite dramatically during the last years. Its not perfect though: it lacks features and ecosystem is still not in the level of maturity of other platforms, but is definitely going in the right direction. Regarding the single threaded server, its an architecture used before JS exists, and used by many other platforms/systems. Just to give you an example, Nginx workers…

In Nginx you're not doing computation, just passing IO thru between file system, external processes (i.e. PHP via fpm) and the network. If Nginx ever is CPU bound there's something bad happening.

As I mentioned PHP: In PHP each worker is single threaded, too, but you can scale by having more workers in isolation.

Re: JavaScript is Eating the World

#29
post #5

Not sure I understand the usage attributed to Netflix? Sounds like the writer is saying that front end is node, but that can't be right? Can someone who knows what they're using node for go into a little more detail?

Other than their front-end build process, Node is also used in their user-facing servers. Basically, when your Netflix app makes a HTTP request to fetch any data from its backend servers, the request first hits a Node JS server.

Something like this: https://medium.com/the-node-js-collection/netflixandchill-ho...

Re: JavaScript is Eating the World

#30
ARG! The floating point handling in JS bites (bytes?) me almost daily. I code in JS every day but I hate this number "bug" the most. Having to frob back and forth with "int" to make it not totally broken.

Am I the only one?

Post reply on HN