Earlier quoted context omitted.
It still sounds like a pretty cool idea to me - I'd certainly check it out if something like that existed.
But would you also: * Come back regularly to play it? * Pay to play it?!! :/ * Click on ads? (If the creator were evil, they'd confuse the users into clicking on ads, making them think it's part of the game). Still a fun thing to make though!
Experimenting with Node.js
51–60 of 88 posts
Re: Experimenting with Node.js
#52Web sockets are great, but almost all of the demos I see use a separate port (i.e. not port 80), making the app useless in practice. Come on guys - it's _Web_ sockets, not intranet sockets.
Could you elaborate on why a nonstandard port makes these apps useless?
if 80 is impractical, many people suggest running off 443 as that (the https port) is unlikely to be filtered.
Re: Experimenting with Node.js
#53Earlier quoted context omitted.
Could you elaborate on why a nonstandard port makes these apps useless?
corporate firewalls blocking nonstandard ports, you running other apps on those ports, your firewall throwing a wobbly, general nonstandardness. if 80 is impractical, many people suggest running off 443 as that (the https port) is unlikely to be filtered.
Some of the node.js websocket impls let you do this easily while others don't. Don't use the ones that require a separate port. Nobody behind a corporate firewall will be able to use your app if you do.
Re: Experimenting with Node.js
#54Earlier quoted context omitted.
Whether you like the model or not, the fact is that JavaScript with it's callback/event based model is what browsers understand. And the internet isn't going anywhere anytime soon. Node is an attempt at using this successful model on the server too where is can solve massive scalability issues using the exact paradigm front-end devs already know. Also while there are many technical ways to make code look blocking, bu…
I think javascript is a fine little language. But: I don't make my server-side language decisions based on what happens to be in the browser. To think that a language required for use in such a constrained environment is just _coincidentally_ also the best language to use server-side where people have been doing event-based programming for decades seems... unlikely. It would be as ridiculous as asserting that we shou…
It's a lot better than writing C, (which is what Ryan was doing before starting node) since JS has closures, anonymous functions and other functional niceties that make event based programming much easier.
The fact that you can now code your server-side code in the same language and paradigm as your client-side code is a huge bonus, but was not the reason node was created. V8 is an amazing VM and it's a language that lots of talented developers know. Why not let them loose on the server and see what comes out of this talent.
Given the constraint of using JavaScript on the server, node is the best solution. If you don't want that constraint, then maybe erlang or something with no-shared state is a better solution.
Re: Experimenting with Node.js
#55Earlier quoted context omitted.
Coroutines bring their own headaches and baggage. To say that callbacks are behind "state of the art" is a little misplaced,; its just a different way of doing things. With coroutines you have to worry about IO all over the place and have to make your functions coroutine safe and Ryan Dahl, the node.js creator, will argue with you all day long about coroutines vs callbacks. I do agree, though, that developers should…
"With coroutines you have to worry about IO all over the place and have to make your functions coroutine safe and Ryan Dahl," No, no, a thousand times no. Node.js partisans really need to start actually using Erlang or Haskell for a little while before spouting this canned line off. You do not have to jump through enormous hoops to deal with IO in Haskell or Erlang, it just works . Callbacks are behind the state of t…
With a callback-based system, stacks are short, and you explicitly carry that state. You KNOW what state you're storing, and you can see it easily.
There's some benefit to that.
And the pattern for aggregating functions is different: Receive a starting event, emit a done event -- you aggregate processes into sets of events, not into function calls. So yeah, it's not going to follow some of the same patterns that non-event-driven code follows, and event-driven code is going to look rather different than callback-passing code.
I think Ryan's right about coroutines, too: Coming back to vastly different state after a simple function call is basically going back to the days of using global variables.
Re: Experimenting with Node.js
#56While I think it's great that more and more developers are being exposed to building network applications using async I/O (which I guess is "evented" now) via Node.js, I think it's worthwhile to point out that the state of the art has moved well beyond these kind of callback frameworks. The reason is simple: it sucks programming in callback patterns on serious, large projects. You end up with lots of routines that ar…
Use Step, man: http://github.com/creationix/step
http://howtonode.org/control-flow http://howtonode.org/control-flow-part-ii http://howtonode.org/control-flow-part-iii http://howtonode.org/do-it-fast http://howtonode.org/step-of-conductor
Re: Experimenting with Node.js
#57While I think it's great that more and more developers are being exposed to building network applications using async I/O (which I guess is "evented" now) via Node.js, I think it's worthwhile to point out that the state of the art has moved well beyond these kind of callback frameworks. The reason is simple: it sucks programming in callback patterns on serious, large projects. You end up with lots of routines that ar…
I've heard this before. "Oh, callbacks are fine for little things like this hello world demo, but for Big Programs, you need (threads/coroutines/etc.) because they're Serious Business." That might be true. Maybe for Big Programs, something else is better. But I think the problem is that setting out to build a Big Program for Serious Business is Doing It Wrong. The best frameworks (or, at least, my favorite frameworks…
Re: Experimenting with Node.js
#58Earlier quoted context omitted.
"With coroutines you have to worry about IO all over the place and have to make your functions coroutine safe and Ryan Dahl," No, no, a thousand times no. Node.js partisans really need to start actually using Erlang or Haskell for a little while before spouting this canned line off. You do not have to jump through enormous hoops to deal with IO in Haskell or Erlang, it just works . Callbacks are behind the state of t…
It's really a question of how much state you're storing, and how you're dealing with that. Many languages and many runtimes allocate stacks in megabytes, and store every local variable in it. With a callback-based system, stacks are short, and you explicitly carry that state. You KNOW what state you're storing, and you can see it easily. There's some benefit to that. And the pattern for aggregating functions is diffe…
If you don't want global variables, don't use them! If you don't want side effects, don't use them either. Those are the same decisions you make, callback or not. Both are great ideas.
Example 1 (callbacks):
function do_request() {
return get_from_database(argument,
callback=function (database_rows) {
return make_html_table_from_rows(database_rows);
});
}
Example 2 (coroutines): function do_request() {
database_rows = get_from_database(argument);
return make_html_table_from_rows(database_rows);
}
What about the second requires a vastly different approach to state? What about the io loop "up the stack" has fewer effects or global variables than the loop called into at the coroutine?In fact, clean state management is easier!
Example 3 (coroutines):
function do_request() {
database_rows = get_from_database(argument);
tweets = use_twitter_rest_api(...);
return make_html_table_from_rows(tweets, database_rows);
}
I can do the first two calls serially without either passing through the first, or using a global variable or some kind of catch all "context". The local frame is the context, which is the oldest, most straightforward, most tried-and-true context in the book.Re: Experimenting with Node.js
#59Earlier quoted context omitted.
I've heard this before. "Oh, callbacks are fine for little things like this hello world demo, but for Big Programs, you need (threads/coroutines/etc.) because they're Serious Business." That might be true. Maybe for Big Programs, something else is better. But I think the problem is that setting out to build a Big Program for Serious Business is Doing It Wrong. The best frameworks (or, at least, my favorite frameworks…
I don't know how to completely address your post b/c it responds to assertions I didn't make. I said nothing about "Serious Business"--and bundling threads and coroutines together is like bundling horseshoes and bicycles. I made no defense of threads. Callback style, within an I/O handler, is (almost always) a concession to the event loop. When I'm writing a program, I write: routine(): result = do_one_thing() do_nex…
Re: Experimenting with Node.js
#60While I think it's great that more and more developers are being exposed to building network applications using async I/O (which I guess is "evented" now) via Node.js, I think it's worthwhile to point out that the state of the art has moved well beyond these kind of callback frameworks. The reason is simple: it sucks programming in callback patterns on serious, large projects. You end up with lots of routines that ar…
Programmer-mentality is somewhat different from other mentalities, but it's still bound to simplicity laws. The technologies you are describing were already there, but it's not just a problem of technology, feature set or execution power. It's also a matter of simplicity. Node.js is working because it gives so much power with a very simple approach. And by approach I mean also how much is simple to understand it and…