Why I changed my mind about Node.js
calebmadrigal.com
calebmadrigal.com
Other than that, the article contains zero interesting information. Somebody had an uninformed opinion of Node.js, then changed that opinion because he heard some good stories, and now he convinces himself with funny arguments that he's right.
(I had too many upvotes recently anyway :) ).
I'm nearing the end of my first large Node.js project. I may do a retrospective after, but TL;DR - it hasn't disappointed :)
Also was wondering if you had heard of SignalR in .NET, and if you had, what your thoughts on it are? I don't know a ton about it. I've heard good things from other C# dev friends, but it seems to be aimed squarely at the real-time/near-real-time web arena
What I personally find wrong with Java is the extreme verbosity of the language, the verbosity of maven (it's the only build system I've used for Java), the extreme memory consumption for little benefits and generally the Architect Astronaut mentality that is so easily associated with Java.
[0] http://www.joelonsoftware.com/articles/fog0000000018.html
Sure, it has similar static typing to Java, but it also has the same coding workflow as any other compiled environment, not the workflow of an interpreted environment.
Parent may also have been thinking of Go's concision, which feels more like using a scripting language than using a class-based monstrosity like Java, and certain other features, such as type inference that make variable declaration as painless as weakly typed languages.
I have a few projects at work I think I can squeeze SignalR, which should be interesting. I've heard good things from a few devs that I know of that have used it.
We've been building tools to work with Excel files. The hardest problems aren't related to writing code. It's all about finding files that use different combinations of Excel features from different versions of Excel (and files from external tools that read/write files). For example, if you start from Excel 2011/2013, you wouldn't know about the custom smart tags that were removed in Excel 2010. However, those records are still persisted (e.g. BrtWbFactoid in XLSB), so you would need to produce a file from Excel 2007 to actually reproduce the error.
For other people to discover errors in python or java libraries, they have to try it in some capacity. That either involves installing something foreign (which may be prohibited or undesirable) or submitting data to a third party (which is most likely forbidden).
A pure-JS in-browser solution can address both problems effectively. We have a cool little web demo which parses excel files in the web browser: http://oss.sheetjs.com/ No installation required. Files are processed in the web browser (HTML5). We've received reports from many organizations involving confidential data. Over time, we've built other tools to inspect features of files without requiring that people send us the original file, and this allowed us to test bugfixes without having to share files.
Now for the really cool part: NodeJS exposes some features like Buffers that make data processing competitive with python or other scripting languages. But since it uses the same code for parsing, fixes to the web version immediately benefit the NodeJS version. As a result, our server-side code (http://npm.im/xlsx and http://npm.im/xlsjs) benefits from the performance of V8 and from the exposure that a browser-based solution enables.
Nice job, this is the single best argument in favor of using NodeJS for something I think I've ever seen.
"Our first adopter of node.js in production wasn’t a minor application; it was our account overview page and one of the most trafficked apps on the website. We decided to go big, but we also mitigated that risk by building the equivalent Java application in parallel." -- https://www.paypal-engineering.com/2013/11/22/node-js-at-pay...
So, in this case Node wasn't being compared to a legacy system.
Other people are using it.
It's less verbose than Java.
It has a package manager and libraries.
It has a REPL.
I stopped worrying and learned to love callback hell.
I didn't have to learn another language.Edit: my mistake, useless reddit joke posts are now welcome on HN, I missed the memo
I like reading.I understood a lot of functional concepts from Lisp before reading the book. There might be something else you need first if you've had no exposure to FP, But if your basic FP-fu is good, this is a really nice book to read.
I really enjoy functional programming, and with those two libraries I feel like I'm writing in something approaching Clojure (but with less ceremony, faster startup times, a truly colossal user community/ecosystem, and less memory bloat). I never thought I'd say this about Javascript, but it clicks off more items on my dream-language list than anything else I've used (and I've used at least a dozen, across several paradigms).
It's honestly fun to write in JS these days (at least for me).
Of course, I have no idea what your use-cases look like . . .
This is a small command-line program that I use to compute grades (I have larger stuff, of course, but this one is easy to follow).
There are important differences between Clojure and Javascript (cum lo-dash and Immutable). Perhaps the most important overall difference is that Javascript is never mandating immutability -- you have to watch carefully (and I'm probably screwing it up a few times in that code). In fact, I just noticed a bad example of mutating state when I pasted it. :( I also use imperative constructs from time to time, but I like that I can.
I originally wrote this code using JS's object system. I absolutely hated it (and I do understand prototypal inheritance quite well).
What's more important to me, is that actually writing the code feels "lispy." In that code, you'll see all the classics (especially as you move down): each, map, range, zip, and compose (my favorite). Lo-dash, of course, has many, many more.
You should look into it.
- https://github.com/puffnfresh/bilby.js
- https://github.com/fantasyland/fantasy-land
- https://github.com/baconjs/bacon.js
- https://github.com/kriskowal/frb
- https://github.com/swannodette/mori
- And essentially all things PureScript: https://github.com/purescript/purescriptThe language looks good and it seems to be somewhat popular with more than 700 stars on GitHub. Thanks for the suggestion!
That stuff is definitely getting you pretty close to Clojure.
Edit: While I use it primarily for ajax, skipDuplicates and flatMapLatest are a godsend for building autocomplete
When you choose a brand new language, the people doing the coding are ones willing to learn / try new things. This means you won't have dinosaurs working on your project.
I like using Node.js with ToffeeScript (which is a variant of CoffeeScript). I liked Node before most people realized how cool it was. I am also sort of into bash these days.
Down the line I would like to get into things like LiveScript and Nimrod.
And then down the line I would like to move on to some kind of system based on description logics that makes it convenient to integrate systems because programming languages and data can be translated to and from a common (DL-based) language that can be reasoned on.
That's the joke? Or were you serious?
Also, I hate hipsters and have no friends and am about the farthest from a hipster you could ever be, BUT I _did_ have a "fixie" when I was a kid 30 years ago. That was because we were lower-middle class and my parents were cheap though.
Also, I did finally purchase a pair of skinny jeans on the direct advice of a lady friend last year. Despite having put on at least six pounds, they still just about fit. Pretty amazing actually. It is a little embarrassing wearing them outside, but if I am honest, they are my favorite jeans.
LOL.
Despite the program being very poorly constructed (by myself, of course), it was still running reliably on the machine much much later. It's a simple websocket (faye/bayeux) demo that allows multiple users to edit a grid concurrently.
Plain version: http://faye.pp19dd.com/ - works on iphones and such, and a HAL 9000 babylon.js version: http://faye.pp19dd.com/index2.php (Instructions: click on squares, use mouse wheel and such to move camera.)
At some point in putting the program together, I realized that I could write modules that could work on both the client and the server without any modifications. IE: client, server data structure. Maybe I'm rusty these days, but mind was partly blown.
But I’ve always been hesitant of dynamic languages in general, preferring statically typed for any codebase of significant size. The last decade has been a bit discouraging for me in this regard. First everybody was loving Ruby, then seemed that Python has overtook it in attention. And then Node.js came along and I really felt like Bromden with a pillow, looking for a way to smother the insanity.
(As an aside, I do quite like Ruby as a language, and writing Coffeescript - the wonderful lipstick for the pig that is javascript - has given me an appreciation for the indentation feature a’la Python.)
The number one problem to my mind with using dynamic languages for a large codebase is maintainability. Refactoring a compiled, statically typed language is so much easier. There is so many potential errors that the act of compiling and type checking eliminate for you that you don’t get with dynamic languages. The focus on huge amounts of unit tests always seemed like compensation for this. And refactoring code is so much easier. Add another parameter to a function, try and compile and you find all the places in the code you need to fix. Maintaining a sizeable amount of code, or code you haven’t looked at for a while is so much easier.
And I get the feeling the pendulum of opinion is starting to swing back in my direction. Running stuff in a web-browser is now a serious concern, and good hackers are working on ways to portably do good programming in anything but Javascript. From asm.js to Dart to PureScript and others.
Newer languages like Go and Rust are taking the nice features many have lauded in the last decade as the advantages of dynamic languages. Things like good package management, less boilerplate and such, and baking them into static languages. So my outlook is getting rosier.
Tools like yeoman, grunt, bower makes it that much more pleasant.
Libraries like expressjs, mongoose, passportjs, and many more can do a lot of the heavy lifting, taking away some of the pains of writing boilerplate.
All and all I'm a fan. I'd love to use angular against firebase only without a node server, but I can't justify the cost.
I don't think developers appreciate how amazing this feature is in a language.
Code should be a data-structure giving you all the benefits of data-structures including persistence.
Now I'm spending my time writing view code that can run on both the server and client, allowing me to render the same stuff statically (for fast initial load and SEO) and dynamically on the client (for fast page changes).
It's also one of the reasons that I've ended up liking CoffeeScript more - Promises have a lot of function() and return statements, CS makes that kind of code a lot cleaner. For instance, that JS could be this short in CS:
Promise.filter files, (file) ->
fs.existsAsync(file).then (doesExist) -> !doesExist
.each (file) ->
fs.writeFileAsync(file.filename,file.content)
.then ->
Promise.map files, (file) -> fs.readFileAsync(file,'UTF-8')
.then (fileContents) ->
console.log(fileContents);
###
Will return:
[
"File 1 Content",
"File 4 Content",
"File 3 Content"
]
###
.catch (err) ->
# This will catch any and all errors that happened above.Javascript is finally catching on to this with generators (yield statement) but it bugs me when people talk about callbacks as if they were a good thing.
Non-blocking, single-language, npm. What's new?
So yeah, I very much disagree with you, but hope I will be wrong and Meteor will be usable for more than a blog or prototype.
What don't you like about Meteor?
I decided to do the latter and get actual stuff done. Node.js is fun and all, don't get me wrong, but once you get over the hype and really dive into it you are better off with Java.
- At any time, the core team can drop the support of the 0.x versions - NPM is still bugguy compared to gem or pip - The "vision" is something that might change radically. (c.f. the recent issues with some core collaborator)
The vision absolutely is not going to change, and as far as I know the issues with the core contributor were quite a long long time ago.
Anyway every project has issues with people. But at this point, Node is probably right up there actually if you were to make a list of projects that had the least likelihood ever of being impacted by politics. Just because there is such a huge enthusiastic community, great package manager and culture of modular development, etc.
- JS is difficult to maintain
- JS is difficult to statically analyze
- Callback hell is a stupid thing to voluntarily subject a team to
- JS is notoriously difficult to debug
- It's much harder to find "good" JS resources, but much easier to find "bad" or "mediocre" JS resources
It's not because it's JS that we can fire the architect, SOLID principles (yes, they still are quite good practices), and abandon all sane project management.
Truth is, there's no silver bullet, it's always a trade-off, blah blah blah. In the end, I found it easier in JS than C to adapt the quality management of the project with it's criticity.
Yep, I have some slightly critic components which run in JS right now, and I'm OK with that.
My crush is Ruby and probably will always be. She is beautiful but sometimes her mind is slow and I always liked fast girls. She is great girl, don't get me wrong, but not to marry. I'm afraid one day she will run away. In my street there are also 2 sisters, Lisp and Clojure. A cousin of them (Autolisp) was my first real girlfriend but we grew apart. Lisp, the older sister, was the most beautiful woman I ever met, it's a pity she is too old for me. Her younger and gothic sister (Clojure) is still a teen and unpredictable. Anyway their family is not very apreciated in my town, people say that they are weird and anti-social. I like them but what would my parents say about a relationship like this?
Then there's Javascript. I don't have a passion for her, neither she is the most beautiful and perfect girl I know. Anyway she is good enough for me, I'm just a hobbyist, not a ninja. She is the kind of girl that will be always there for me. Slowly I will love her also, I'm sure of it. If I get really bored I'll take her unstable but so damn pretty co-worker as a mistress (Coffeescript) but I will never divorce Javascript, she's a woman for life.
Im 34. I played around already, I don't want to look for more women. I'm old enough to marry and put on my leash.
My reasons to "marry" Javascript:
- JS is present everywhere and will be for a long time. Coming from a struggling field, I'm tired of begging for work;
- I'm an hobbyist, JS still have a lot of amateurs, I'm still in time to jump on board. It's the wild West now;
- Autocad (my field) just got a JS API.. ;
- Meteor. IMO it has a bright future: it's cool (it's a kids project), user friendly (women involved in the development) and open to newbies (including hobbyists from different fields like me) https://www.youtube.com/watch?v=Z3cOLFP-ZyQ&list=UU3fBiJrFFM... (This short video of a Tattoo designer running a business on Meteor was an epiphany for me).
Note: This is just an humoristic comment, don't take it too seriously..
I know you're probably well intentioned, but that and a number of other things in your post are pretty heavy on the stereotype side of things ("women = user friendly" and "put on a leash" are two other examples) and it's the kind of stuff that adds little bits of stress to my work day, which add up over time since there are plenty of guys who do stuff like that without really thinking or actively meaning harm.
You have some good points/language comparisons - could you phrase them in a way that doesn't create unnecessary implications?
Think of it like a speed bump - a single speed bump on your street isn't that big a thing, and isn't really a problem on its own. But if there was a speed bump every 5 feet along your street, that would get tiring fast - even though the basic concept of a speed bump isn't itself the problem, it's just the repetition that's the issue.
I have nothing to be shame of. I am not offending anyone. I am expressing an opinion (in a specific style) that I consider to add value and possibly help someone out there. It would certainly have helped me sometime ago when "adjusting" my career path and choosing a computer language to learn.
Don't take life so seriously that the world offends you.
I think that you are though. It might be a small bit of offence, but it all adds up: http://juliepagano.tumblr.com/post/46206589124/my-experience...
You're basically telling people to not be stressed out when they're biking and cars pass them too closely, because the car had a reason to be on the road. "The car needed to get to the hospital. You shouldn't get upset about being passed." The thing is, it doesn't matter if the car had a good reason to be going fast and passing in narrow sections of the road - it's still going to stress a bicyclist out to get passed closely, regardless of whether it was malicious, and regardless of whether there was a good reason for it.
Note that the style is what's irksome about the original comment, not the opinion. When you talk about the value of the opinion, and gloss over the style like this, I feel like you're failing to understand why people disliked your post.
I understand why you didn't like his comment, but that doesn't justify the misquote. That being said, if you couldn't read his comment well, I understand. His comment's hex color is almost matching the background.
If you do think it refers to the common trope, I'm curious why you think "my" versus "a" makes a difference.
Regardless, the point of the quote marks in that parenthetical was to denote common tropes that appear in his comment, not to use his exact language. I'm sorry that their usage was confusing.
Nope, we're in agreement there.
> the point of the quote marks in that parenthetical was to denote common tropes that appear in his comment, not to use his exact language.
Exact language can be important, especially when quotes are being directly sequenced. In this case, sequencing two quotes with different subjects, while modifying the second quote to be more subject agnostic, is problematic.
> I'm sorry that their usage was confusing.
No worries, sounds like you didn't intentionally modify the quote to redefine the meaning at all.