DEV Community

Discussion on: Explain nodejs to me like Im five

 
nhsz profile image
Nicolás Quiroz • Edited

Besides familiarity with the language if you've been on web dev before, I think the main "selling point" of NodeJS for devs is that it was able to greatly simplify the problem of concurrency. You have only one thread available so you forget to deal with threads and all that stuff.

Of course you now have to deal with other problems, i.e.: callback hell and async thinking.

Resource efficiency (hence lower costs) and scalability is the other one.

Thread Thread
 
jochemstoel profile image
Jochem Stoel

I would like you to elaborate on the problem of concurrency. What practical problem did this solve for you? What were you struggling with every day that Node solved by being single threaded? Do you even know why it is single threaded? I am very curious because the majority of web developers that are considered competent have zero understanding of this.

Thread Thread
 
nhsz profile image
Nicolás Quiroz

I mean, you don't have to deal with multiple threads like you do if you're working with other server-side languages.

Multi-threading is hard, like sharing data between threads. If you are working with server-side web programming in PHP, Java, Python, etc you will have to deal with it unless you have very low traffic APIs or services.

I think Go's approach to concurrency with "light threads" and goroutines is better than the async model though, but Node's was quite clever.

Thread Thread
 
jochemstoel profile image
Jochem Stoel

I think I have never reached any point where I needed to deal with multi-threading when I was writing something in for instance PHP. I suspect that I do this all the time.