WebGL + Node.js + WebSockets = A Web Technology Perfect Storm
travisglines.com
travisglines.com
<rant>I am getting a little tired with the node.js cheerleading on HN. I've tried it and I don't see it as a huge leap forward from what can be done with Twisted + Python, or Go, or many other solutions. The major drawback is that you're writing in Javascript -- and maybe I have been doing something wrong, but any sufficiently complex JS app tends towards callback spaghetti, in my experience. (And I do like writing JS)</rant>
The existence/prevalence of node.js submissions does not imply that anyone thinks it any more technologically capable than Twisted, Go, Tornado, or eventlet. Node.js just happens to be simpler to install, have more easily accessible documentation and has more of a network effect going for it.
But my complaint is that it seems a lot of attention is paid to projects which are not actually doing new things with node.js, just things that have already been done with other technologies.
Actually, this comment sums it up much better than my comment: http://news.ycombinator.com/item?id=1549023
I'm not saying javascript is the king of languages, just that we're limited to it because that's what's in the browser, and writing server code in the same language simplifies things.
The server and the client has such different concerns that code sharing probably wouldn't contribute that much.
Validation is also two different concerns if you compare serverside vs clientside.
http://stackoverflow.com/questions/162159/javascript-client-...
Basically: Client side validation is about user experience, Server side is about security. I'm hard pressed to believe you can get both with the same code.
I also don't see how localStorage is relevant to code sharing between client and server.
That's a fallacy, the environments have nothing in common, the coding styles and interactions don't either, the only things you're going to be able to meaningfully share are trivial helper libraries à la underscore..
> and writing server code in the same language simplifies things.
Why? How? Where? I see that assertion often, but I have yet to see it backed by anything but "because I said so".
One example: you can run the same input validation in the client as you do in the server if you can easily share code between the two.
But there is way more. Here's an example of an application that shares all of its data models between client and server: http://tilemill.com/docs/models.html
Using the same language on client and server can come in handy if you've got some non-trivial amount of code they can share in common. When I made a multi-user text editor (think Etherpad, but simpler), all the code for transforming the editing operations so that everybody's documents converge was written in a single JavaScript file, which I ran on both the client and the server, via node.js. That was great. That was fun. But if you don't have a situation like that, where's the advantage in using JS on the server?
As for client-server development, I think the future is going back to the client. Instead of "dumb clients", what we have now are extremely powerful and fast clients. It's much cheaper to send raw data to the client and compute it there, since as a web developer you pay for server CPU, but not for client CPU. (Of course, it's a little wasteful since the computation happens many times instead of one; but you can always send the results back to the server for caching, if that worries you).
I am confused: if you don't like bash scripts why in science's sake did you keep using them instead of one of the billion alternatives out there?
> This is an area where node.js really shines and that is not often mentioned.
Because it's nonsensical. What makes node.js "shine" more at batch processing more than every other language on the planet?
Because every other language on the planet is not Javascript...?
- - -
Edit: maybe I should clarify? The only other solution (that I know of) to write Javascript for the server is Helma; I've tried it and it kind of works but it's very clumsy. Is there another simple way to write JS on a Linux box?
- - -
Edit2: maybe I should not clarify.
Callback spaghetti is quite easy to avoid.
> and maybe I have been doing something wrong
If you have callback spaghetti, regardless of the complexity of the app, you are most likely doing something wrong.
> I don't see it as a huge leap forward from what can be done with Twisted + Python, or Go
Of course not, but it's not hard to imagine that Node.js will have the biggest ecosystem in this space and with it comes advantages (and perhaps disadvantages).
That's what people say about most bad programming practices. "It's not the language, you can write good code in the language." This doesn't really help, though. The reality of programming is that different languages encourage different styles of programming. They shape the eco-system, the space of the solutions you will find for you problems.
JavaScript lacks tools for managing complexity. I don't work with it a lot, but most of the JS code I've seen recently was, in fact, callback spaghetti (with arbitrary global state modifications). That's the ecosystem the language created. Hearing how it's avoidable doesn't make my life any easier when I work with such code.
Part of my job has been to remake visualization software (for brain imaging research) on the web and aside from some really heavy stuff, WebGL has served me well. Javascript engines are getting so fast, I haven't had problem computation heavy tasks that much. Most of the time it's my code that's shitty.
Now my most limiting factor is the damn slow upload speeds I get in canada. If only I could get 2-3 Mbps up, I could do some great stuff.
We also use Go and not Node.js for the backend so the only thing qualifying us for this perfect storm is WebGL.. :-)
Very cool demo built by Travis, 3D WebGL chat
re: WebGL games. The clients will all be "open source" (as they're javascript). What effect do you all think that'll have on the future web-based gaming industry?
Since I'm currently developing a WebGL game I'm actively searching for ideas to detect that behavior.
The only solution I can think of is, to capture any data with timestamp coming from the client and applying some tests to it like "is the client sending more messages than a normal client" or more advanced: sending the input through a statistical filter to detect possible cheating and investigate from there on.
It might be an idea to think about the actual mechanics of the game once you've come up with a possible solution so that the game itself doesn't invite cheating behaviour or at least makes it easier to detect. i.e. Making it physically impossible to shoot faster than a specified rate or move too quickly/accurately, etc.
Good luck!
http://hacks.mozilla.org/2010/12/websockets-disabled-in-fire...
Hopefully it will be re-enabled in Firefox 5.
That said, there's horrible tearing and it's also really slow when you are near another box and looking at it.
google-chrome --enable-webgl --ignore-gpu-blacklistI figure I might as well let you know what you're missing. The guy coded up a 3D world in which you walked around as a square with text floating above your head. It reminded me of World of Warcraft and other MMOs, despite its graphics being far below those of Minecraft.
http://webaim.org/articles/seizure/
or make it not do that
Its fun watching what people say about it. They want to know why its there, why its black and if its real.
Old meme is old!
Writing a chat app is one thing. Writing a node.js 3D MMO is quite another.