3 ms·
Those have attractive qualities too, you're right. One advantage to using something like Node.js, however, is language homogeneity: having all your browser cli
by mkramlich 16y ago
Those have attractive qualities too, you're right.
One advantage to using something like Node.js, however, is language homogeneity: having all your browser client-side code and server-side code in 1 programming language. While it's good to use The Right Tool For The Job there's also a benefit to having the simplest solution possible, with the least amount of moving parts, and requiring the least amount of tech knowledge (esp languages) to deliver that solution. While I prefer Python to JavaScript, if we never get to a world where Python is built-in to every browser there is some attraction to moving in the other direction. "If you can't beat 'em, join 'em."
- thomaspaine 16y agoI never understood this argument. Client side javascript and server side javascript aren't really the same at all, it's not like you can re-use your client side javascript on the server. The only benefit I see is that you don't have to context switch between python and javascript, but the only time I can remember this affecting me is when I forget to type semi-colons.
- aaronblohowiak 16y ago"it's not like you can re-use your client side javascript on the server". The other is more appealing. The wins for client/server code share are for things like field validations and templates.
- Encosia 16y agoThat's not always true. Templating is a perfect case for reusing code on both sides of the connection. In the optimal scenario, the browser can render a template based on requests for JSON data. However, if the client doesn't support JavaScript, the same template can be rendered on the server-side and fed to the browser traditionally. Great for accessibility and SEO. Input validation is another situation that's a great candidate for shared code. Another nice benefit is that server-side JavaScript brings an assortment of mature DOM selection/manipulation engines with it. I believe there was an example of using jQuery on the server-side with node.js posted here recently. Jaxer[0], which was ahead of its time, had a nice approach to sharing client/server logic with its runat="both". It's a shame that project never got much traction. [0] http://www.jaxer.org/ http://www.jaxer.org/
- bootload 16y ago"... it's not like you can re-use your client side javascript on the server. ..." nodejs and jsdom perhaps? "jsdom + jQuery in 5 lines with node.js" ~ http://news.ycombinator.com/item?id=1665999 http://news.ycombinator.com/item?id=1665999