Live data from Hacker News

If you're using Node.js, you're doing life wrong

codeslinger.posterous.com

91–100 of 100 posts

Re: If you're using Node.js, you're doing life wrong

#91

Programming with Node's async model makes it extremely powerful and fast to run database queries and file functions in parallel, but the downside is the potential for huge callback spaghetti indeed. But the callback spaghetti problem can be largely solved by dropping in, for example, the IcedCoffeeScript fork: http://maxtaco.github.com/coffee-script/ Or the previous JavaScript TAME functionality: http://tamejs.org/ T…

If you expect a lot of callback it makes more sense to design that functionality as an object rather than as a single function. That way you can spread callbacks over many functionality and still maintain modularity.

Not necessarily -- the issue is not so much code modularity as much as control-flow issues, which separating out functions (mandatory) doesn't necessarily help with (because of all the flags of what function should call what other function afterwards, etc.).

Re: If you're using Node.js, you're doing life wrong

#92

I guess it depends on what I how I want to do my life. If I want to live my life by learning new ideas and using those ideas for something tangible, Node's a pretty good choice. If I want to live my life as a person with a particular language/architectual ideology, then anything that is not in that world view is wrong. I like node for system level scripting. I find bash annoying and non portable to windows. I really…

If you like Node for system level scripting, you're gonna love this: http://www.jsdb.org/

Don't let the name fool you, it's not only for databases. I would say that it's probably more suitable for general purpose scripts than Node, though some of the APIs are a bit clumsy.

It's not open source, but it's free and cross platform and actually pretty good for a lot of general purpose scripting. Seems that it is developed by a single guy. I found out about it a few years ago and used it to get some things quickly done.

Re: If you're using Node.js, you're doing life wrong

#94
post #89

Okay, let's play a little game. I'm going to describe a scenario (using Python; feel free to substitute the equivalent Ruby terms if that makes it more relevant for you). You're a pretty good Python developer. You know, and feel comfortable with, not just Python, but the entire ecosystem. Virtualenv, pip, the whole nine yards. And now you're working on a really nifty Django app, maybe a CRM or something, when you rea…

besides templates and simple validations, sharing code doesn't seem to work out all that well.

Re: If you're using Node.js, you're doing life wrong

#95
post #77

Earlier quoted context omitted.

You're welcome to use whatever you like, of course — I'm just saying that you haven't really raised any specific objections that couldn't be (and haven't been) leveled against most other languages. Ignoring the confusion of a language and a framework, so far, your concrete objections seem to be: • Node.js is a framework built by people other than the language's core maintainers (which is true of most frameworks) • If…

No, there is no language v. framework confusion on my part. What I'm arguing is a concrete, fundamental fact that pertains to both the framework and the runtime. I'm not sure what I can do to clarify the point anymore: the V8 engine is created and maintained for the purposes of speeding up a web browser's processing of Javascript within the context of an HTML document. The goals of the team implementing the runtime a…

With regard to getting changes made: Both V8 and the ECMAScript committee have development mailing lists and issue trackers where you can submit and discuss suggestions. AFAIK, this is basically the same way Ruby operates. They aren't likely to make vast, crazy changes, but I don't think, say, a PEP for static typing would get very far either.

And I think it's kind of a basic misconception that V8 is made just with web browsers in mind. If you look on the V8 developer site, nowhere does it say anything close to that. Their stated objective is "fast execution of large JavaScript applications." They go out of their way to draw a distinction between the browser and the engine, explaining what is and isn't part of JavaScript (e.g. the DOM is just an interface that browsers choose to expose). Is Chrome the original client for V8? Sure. And shell scripts were the original use case for Python. It seems to me that "V8 is just a browser language" is the new "Python is just a scripting language."

And I wouldn't describe the language-level ability to write asynchronous code in a synchronous fashion a fundamental feature. It's really cool and allows a lot of expressiveness, but so would a lot of potential changes in, say, Ruby. If you don't want the language feature, there are really nice libraries that get you most of the way there. (And I don't really see how the existence of CoffeeScript or ICS is any more an indictment of V8 than the existence of Scala is of the JVM. Choice is a good thing. Lots of people prefer vanilla JavaScript.)

Re: If you're using Node.js, you're doing life wrong

#96

Here's my problem and why I don't care to use it: It's a community built around an implementation of a language which they do not control. Who is Guido or Matz in node.js? Ryan Dahl I suppose; does he take requests or hold discussions concerning the future evolution of the language? Does he issue any rationale documents concerning his language design philosophy? Could he add multithreading to V8 and if so, why hasn't…

Issacs (the guy who built npm) is now the lead for node. Ryan Dahl has moved back to researching stuff or joyent. Your point about being built around other peoples technology is totally valid, but in regards to coffeescript I think it will prove useful as it will probably help steer development of JS itself.

Re: If you're using Node.js, you're doing life wrong

#97
post #44
post #2

I don't really have a dog in this fight, but I see node.js as being "disruptive": * It's "not as good" as languages/environments like Erlang. * But it's good enough, and significantly simpler, as an approach to tackle a certain class of problems. This, combined with widespread knowledge of Javascript, will probably make it fairly widely used.

I disagree about it being that "disruptive". The concepts that it uses aren't new. They've existed in POSIX environments for decades. At a very basic level, Node.js is a callback-based API that's based around some(probably select) notifier loop. That's not particularly new.

Sure - Tcl has had an event loop since sometime in the 90ies, and you could always do stuff in C.

However, Node is written from head to toe to take advantage of that style of coding, whereas Tcl never had the assumption that everything had to be async, so many calls block. Same thing with Python and Ruby, except that they're relative latecomers to the embedded "select loop" game (sure, modern systems have moved on from select, but it still conveys the idea).

Erlang has been around for a while, and does async beautifully, but for every person who knows Erlang there are 10,000 who know Javascript.

Re: If you're using Node.js, you're doing life wrong

#98
Please give me a break. This guy made some points: spaghetti code, .... He state it in the wrong way, however one should admit that node.js is not mature enougth for many use cases. I'm still learning but, haven't seen how just by using node.js you get a scalable server.

Re: If you're using Node.js, you're doing life wrong

#99

> JavaScript has very little support for any of those nice things: it doesn't even have namespaces, for chrissakes. Why would I want to repeat these same mistakes over and over again in a new language? Javascript doesn't have this (by itself) but node has a very nice require() system that is really excellent for long-term maintainability. When you bump a dependency in a node project that change will only affect the c…

How can we even be talking about node and long-term maintainability when it is about 2 years old? And require is younger than that?

Re: If you're using Node.js, you're doing life wrong

#100
post #89

Okay, let's play a little game. I'm going to describe a scenario (using Python; feel free to substitute the equivalent Ruby terms if that makes it more relevant for you). You're a pretty good Python developer. You know, and feel comfortable with, not just Python, but the entire ecosystem. Virtualenv, pip, the whole nine yards. And now you're working on a really nifty Django app, maybe a CRM or something, when you rea…

Two points for you: 1) CoffeeScript does not require Node...npm may make it much easier to install, but you can definitely run it without installing Node. We run the compiler as a Maven plugin, but it's distributed as JavaScript and all you need is an interpreter. 2) There are templating languages that have interfaces in both JavaScript and other languages to allow the same templates to render on both the client and the server. We use Java on the server, so we're looking at Closure Templates, but for Python, you might want to look at Mustache.

If you've already finished your project, I'm not going to try to convince you to move away from Node, but if you've got a lot to do still, you might consider sticking with Python. I'm not saying that Node isn't a workable solution on the server side, I just don't think it's proven that it is the way that Python and other, more mature platforms have. I don't give too much credence to inflammatory posts like the one being discussed, but when I see posts like: http://news.ycombinator.com/item?id=2519674 from a developer I respect, it gives me pause. That post is 18 months old now, so the situation could have changed.

There's something to be said for building things you know are rock solid and won't result in 2am notifications. That's my perspective, so I try to stay away from the bleeding edge. For stuff that's not critical, I'm more ok with taking a few risks. But someone's got to be the one that takes those risks in a mission-critical environment to figure out which of the new technologies will become proven and which will fail, so I disagree that these people are doing life wrong. If it wasn't for people like them, my way of doing life right wouldn't work.

Post reply on HN