5 ms·
You have solved a problem that didn't exist -- XML and HTML were both reasonable linguafrancas prior to JSON's invention. JavaScript as a server-side langauge
by MostAwesomeDude 15y ago
You have solved a problem that didn't exist -- XML and HTML were both reasonable linguafrancas prior to JSON's invention.
JavaScript as a server-side langauge is not a good thing; JavaScript is not a good systems language. We've already had an era of a poor systems language (PHP) being predominant in the web application space, and the conclusion was that there are better languages which can more effectively represent both general systems tasks, and specialized web tasks.
NoSQL databases will never be relational DBs because they explicitly eschew the relational algebra that powers the latter. Similarly, Node isn't a serious server-side solution explicitly because of its reliance on JavaScript.
Finally, I should point out that JSON isn't a subset of JavaScript. This means that you can't exec it as JavaScript in all cases, and even if you could, exec/eval is massively dangerous and should be avoided. This means that you're parsing JSON, which means that you no longer have an advantage over other languages -- Perl, Python, and Ruby all have very strong JSON support. (Python even has it in its standard library now.)
- nakkiel 15y agoRegarding Javascript, I think it suits well the async paradigm because that's how people expect Javascript to be. Why isn't Javascript a good server-side language?
- smtf 15y agoI agree that js does support the async paradigm for the reason you mentioned; however, at the risk of sounding like I'm speaking for the op js would not be my first choice for system or server side programming. The simple reason being that javascript's behavior is often near inexplicable, many examples can be found here: http://wtfjs.com http://wtfjs.com. I'm tolerant of that strangeness while manipulating the DOM but really only because there are no other choices.
- ricardobeat 15y agoEvery language has it's own WTFs. Many of the ones in Javascript are shared with Ruby, Python and other interpreted languages. They hardly bite anyone in a real project.
- smtf 15y agoIf by real you mean yours fine; however, your projects are not everyone's. If you'd like you could respond with specific cases you've used javascript for system or server level programming.
- htilford 15y agoWhat part of JSON isn't a subset of JavaScript? "JSON is a subset of the object literal notation of JavaScript. Since JSON is a subset of JavaScript, it can be used in the language with no muss or fuss." http://www.json.org/js.html http://www.json.org/js.html
- MostAwesomeDude 15y agohttp://timelessrepo.com/json-isnt-a-javascript-subset http://timelessrepo.com/json-isnt-a-javascript-subset Also see my other reply.
- ender7 15y ago- XML and HTML are good ways to structure data...sometimes. Other times, they're godawful. Especially if you're trying to pass data from one piece of code to another piece of code in order to do RPC-like things (server->client, for example). There's a reason that JSON is popular, and it's not because "it's the cool thing to do". - JSON is a strict subset of Javascript syntax. You can always eval() a JSON string to convert it (not that you should). Many browsers support native JSON parsing now, so it's also very fast. I'm not sure what the downside is there.
- MostAwesomeDude 15y agohttp://timelessrepo.com/json-isnt-a-javascript-subset http://timelessrepo.com/json-isnt-a-javascript-subset JSON isn't a strict subset of JS. Moreover, no, you should never eval() things which are untrusted. Do you really trust everything the browser tells you? No? Then why trust JSON? I'm not anti-JSON, I'm anti-JS. Browsers don't support other languages (except for VB, which bites, and Fx nightly support for Python, which I wish would become more widespread) so there's no choice in a browser. On the server side, though, you have a chance to use real languages, so you really should. Oh, and also, you do know that XML-RPC, bless its ill-specified heart, is still around, right? There's a whole world of enterprise that isn't prepared to accept JSON-RPC.
- ender7 15y ago...I understand that eval() is dangerous. As noted in my comment. Anyway, what do you count as a "real language"? I assume you mean Java. Which is...fine. But Java is not the answer for everyone.
- MostAwesomeDude 15y agoJava, C, C++, Haskell, Python, Perl, Ruby, C#, Go, Scala, and Clojure are all better languages for systems development. (In no particular order.)
- human_error 15y ago