3 ms·
It's popular because it's in the browser. Everything else is just Stockholm-syndrome. Nodejs strikes me as an unfortunate consequence of having js in the brow
by kpil 10y ago
It's popular because it's in the browser.
Everything else is just Stockholm-syndrome.
Nodejs strikes me as an unfortunate consequence of having js in the browser and a drive for reducing the complexity by having the same language on the server.
- z3t4 10y agoExample of use outside browsers: Windows and OS X scripting, classic ASP, Pebble watch, MongoDB database, Adobe Photoshop PDF et al, LibreOffice, Unity game engine, Qt, GNOME Shell, Ubuntu Touch, Chromebooks. ref: https://en.wikipedia.org/wiki/JavaScript https://en.wikipedia.org/wiki/JavaScript I used JavaScript as a web developer for 15 years, but did not like it. It wasn't until I started with NodeJS three years ago I learned JavaScript in depth. It's when you grok closures, events/async/concurrency, prototype, objects, and commonJS modules it starts to get fun. There where a lot of headache going from serial programming to parallel programming like the pyramid of doom, Christmas tree from hell etc, until I learned to manage it. When CPU's get more cores instead of getting much faster, concurrency is the way to go, and it fits JavaScript well. You should have raised an eyebrow or two reading this, as JavaScript is "single threaded". That just makes things more simple though, if you know how to write event based code, like handling clicks on a web page, you already know how to write distributed systems and can scale beyond a single CPU or server.
- kpil 10y agoI argue that the reason it's used outside browsers is primarily that a generation of programmers learned it first - IN a browser. As a language, it has more warts and less features than many other languages, but it also is unimposing and does not get in your way. It could have been much better though.
- z3t4 10y agoMicrosoft tried to make vbScript an alternative to JavaScript. vbScript is a good language, but JavaScript is better. For example, how to make a custom object in vbScript: Class foo Private barval Public Property Get bar() bar = barval End Property Public Property Let bar(b) barval = b End Property Private Sub Class_Initialize( ) barval = 1 End Sub End Class To make an object in JavaScript: foo = {bar: 1}; Before NodeJS existed, most people, including myself thought that JavaScript is a stupid language only used in browsers. I was also aware of NodeJS for at least two years before I finally tried it. I thought it was stupid why the hell would you want to code JavaScript outside the browser I thought. After maybe one year of learning, walking through the swamps, I finally saw the light. The most revolutionary I think is the module system in NodeJS, it's what makes writing huge programs in JavaScript manageable. Because of this many JavaScript programs now a days comes with thousands LOC tested and hardened in production, while the actual code you write and maintain yourself is only like one hundred LOC. I think the NodeJS module system is maybe hundred years ahead of its time, it's right in front of us, but few people seem to notice. And in the direction we are heading now it will soon be forgotten (ES6 import). People use NodeJS modules like imports and couples the code instead of decouple. Sure it works fine for a while, but sooner or later the project will grind to an halt because of code complexity.
- edblarney 10y ago"It's popular because it's in the browser. Everything else is just Stockholm-syndrome." Not quite. JS is a great language for doing async. I much prefer Node.js over CGI, Java or Ruby back-ends. But yes, there is some craziness given how for so many other reasons, JS is not a great language.