7 ms·
Zef writes this as if it's completely amazing that people are leaving Node for Go. Node is based on JavaScript. There are arguably more things wrong with JavaSc
by skrebbel 12y ago
Zef writes this as if it's completely amazing that people are leaving Node for Go. Node is based on JavaScript. There are arguably more things wrong with JavaScript than with any other popular programming language, as evidenced by book titles like "JavaScript, the good parts". This is common knowledge; we're all trying to do good work despite JavaScript, seldom because of it. So Node: it's fast, we can share code with the browser, but it's a bitch to use. We knew that when we signed up.
Conversely, Python is a great language but it's not as easy to make it go fast. It's slow, but it's great to use. We also knew that when we signed up.
It's great that Go is getting more mainstream adoption! Deservedly so. But it's probably still easier to be super-productive developing a CRUD app in Ruby or Python. And it's still easier to share code between backends and web frontends with Node. If you don't need either of that, and you do need performance, then, yes, maybe you shouldn't pick Python or Node.
I agree that Go is a great option to consider, but Zef is framing it a little as a silver bullet, and well, of course it isn't.
- facepalm 12y agoThere are minor details wrong with JavaScript. Normally you don't encounter them in daily use. Apart from that JavaScript is brilliant. Few other languages can match it's simplicity. Python falls through because it doesn't have real lambda.
- aidos 12y agoAs already stated, it depends on what you're doing. I have to calculate lots of numerical things, javascript isn't brilliant for that at all (I'm not against js, I was an early advocate and have used it for years). Python doesn't have real lambda, who cares? That may or may not matter to you, it mostly doesn't matter for me, most of the time. You've directly commented on a post about how understanding the context in which you use your tools is the crucial factor by totally ignoring the point.
- adamors 12y agoIf you normally only do a couple lines of jQuery per day then I agree that you don't encounter the warts very often. If however you want to do even some OOP you cannot miss the world of hurt that is coming your way. Then there's the horrible weak type system which makes maintenance of anything needlessly complex, not to mention the global variables, unused reserved words, anything that has to with numbers etc.
- nawitus 12y agoTypeScript solves JavaScript's type problems pretty well, it's worth a look.
- lucian1900 12y agoHaving to name a function in Python annoys me a lot less than basically more than half of JavaScript that is entirely batshit crazy.
- _pmf_ 12y ago> There are minor details wrong with JavaScript. Normally you don't encounter them in daily use. Defaulting to doubles and not having native integral types is not a "minor detail".
- mappu 12y agoDoubles do have 53 bits of int precision at least. Did you know libcurl uses doubles to represent file sizes? File sizes that are always integral? Don't ask me why they did that, guess it had better platform support than int64's a hundred years ago.
- adamlett 12y ago> There are minor details wrong with JavaScript. Normally you don't encounter them in daily use. If you really believe that, I can only assume that you either don't have very much experience with Javascript and haven't yet been burned (or haven't yet discovered that you've already been burned), or that you don't have any experience outside of Javascript and therefore are not aware that languages exist that have all the niceness of Javascript but almost none of the bad stuff. I say this as someone who is primarily a Javascript developer professionally. Yes, there are languages that are worse than Javascript to work in (I'm looking at you Java and PHP), but there are many that are much better. It's worth noting that everything that is good about Javascript already existed in other languages before Javascript got invented. In fact Brendan Eich has stated that his intention was to create Scheme for the browser. If only he had just used Scheme as it existed, things would have been so much better!
- BrendanEich 12y ago> In fact Brendan Eich has stated that his intention was to create Scheme for the browser No. Read https://brendaneich.com/2008/04/popularity/ https://brendaneich.com/2008/04/popularity/. "Come to Netscape, do Scheme in the browser!" was the bait. When I got to Netscape, it "had to look like Java". And given timing both internal and due to MS coming after Netscape, it had to be done really, really quickly. /be
- flaie 12y ago> Yes, there are languages that are worse than Javascript to work in (I'm looking at you Java and PHP) Java has an enormous ecosystem, is fast, is stable, has static typing, has more tooling than anything else, is easier to learn, does not have all the gotchas that Javascript has. I don't consider Java a worse language at all. I use Java since a decade, and frankly I don't understand that rage against it while it is a totally valid option to start a project with, even a startup. If you want to get RESTful and all there's everything you need, etc. Take it from a guy doing some Golang since more than one year and enjoying it a lot, also well versed in Python, Javascript, and even OCaml. In fact, the time it took me to write this comment, I decided that I don't care anymore. Use what you need for the job and be prepared to change when something new is out and have a real impact on what you do.
- easytiger 12y agoPython is also slow.
- rdtsc 12y agoNo, pretty fast. Having used it for 10 years. Never had problems with its speed.
- tankenmate 12y agohttp://c2.com/cgi/wiki?PythonProblems http://c2.com/cgi/wiki?PythonProblems http://www.jeffknupp.com/blog/2012/03/31/pythons-hardest-problem/ http://www.jeffknupp.com/blog/2012/03/31/pythons-hardest-pro...
- lumpypua 12y agoNo seriously, also having used it for 10 years it's an issue for python. Three quick personal examples, though I've dealt with a number more: 1. Python web frameworks http://www.techempower.com/benchmarks/#section=data-r9&hw=i7&test=query http://www.techempower.com/benchmarks/#section=data-r9&hw=i7... Carefully configured Flask can get up to 1/3rd the speed of other web frameworks. But misconfigure it, use an ORM, or if you're on django, you're serving 1/10th as many requests/sec with significantly higher latency than other languages. 2. Templating https://stackoverflow.com/questions/1324238/what-is-the-fastest-template-system-for-python https://stackoverflow.com/questions/1324238/what-is-the-fast... Template rendering takes an appreciable amount of time. I had to replace django's (slow as shit) stock templates with jinja2 on a project because it was taking tens of seconds to render a very large page. Jinja is far faster, but it's still slow enough that I had to add a caching layer to a website that shouldn't need one. 3. Numerical shit I implemented a video processing algorithm from a paper for a computer vision class. Python's scientific and numeric libraries were sick and made prototyping delightfully easy--then the final runs on the full dataset took forever. What I re-implemented in C++ was >10x faster. Vectorization and other tweaks can make python numerics go faster, but it's a pain in the ass. One of the goals of the Julia scientific programming language is to make loops fast enough that code doesn't have to be manually vectorized.
- rdtsc 12y ago> Python falls through because it doesn't have real lambda. No it doesn't. Been using it for about 10 years can't remember being bothered by lacks of "real lambdas" > There are minor details wrong with JavaScript. Normally you don't encounter them in daily use. If there would be minor detail we wouldn't have had the "Good Parts" book. And trying to deals with variables in Javascript is pain, var vs no var, what does this do. Really strange weak typing rules. Adding [] to {} should not produce some random value (what is it NaN or Object), it should throw an exception. > Few other languages can match it's simplicity. Wait, were you being sarcastic?
- Karunamon 12y agoI assume you're referring to the "Wat" talk by Gary Bernhardt, here. My question is why does it matter? It's funny and notable behavior, but why is this a problem that a real programmer will face dealing with a real problem? (For reference, [] + [] = "", [] + {} = Object, {} + [] = 0, {} + {} = NaN)
- rdtsc 12y agoBecause it hides errors instead of helping the developer find them
- Karunamon 12y agoAre JS developers often adding empty arrays and empty objects together? This seems more like a corner case than a real issue. (Not snarky - I don't know JS)
- tokenizerrr 12y agoNo. You generally only add numbers and strings together.
- rdtsc 12y agoAs often as any programmers deliberately insert bugs in their code ;-) Those values are usually in variables that and have been set maybe from a backend reply or from the UI at some point. That is just one instance of the sloppy mess of weak typing. Instead of writing a long list of it I just used an example to illustrate.
- cycrutchfield 12y agoYour username is very apt
- Derbasti 12y ago> Python falls through because it doesn't have real lambda. True. What it does have though is real closures. Local function definitions with a proper name, capturing lexical state, usable as first class objects. This is a usable replacement for real lambdas, in much the same way functions are used as a replacement for just about everything in Javascript. There are so many things in Python that have real syntax and language support, and that are lambdas upon lambdas upon lambdas in Javascript.
- realrocker 12y agoWhat part of the article did you read as "Go is a silver bullet? I read it as a list of articles about people/companies who are switching to Go with each giving their reasons for adoption.
- rdtsc 12y agoAlso presumably people who are not switching to Go are not writing blog posts. "We are still staying with Python" "Clojure still works great" "Erlang backend still runs after 10 years" "Node.js router still runs ok" Those don't make compelling HN front page article. So if you read HN the impression is everyone and their grandmother is switching to <LatestFad>
- CraigJPerry 12y agoWhich is a shame, beautifully simple workflows delivering complex results are without a doubt a more impressive achievement.
- skrebbel 12y agoNo part in particular - I don't disagree with Zef or the people he quotes. But the entire article does have this "look, all these smart and influential people are ditching $THING for Go, you should too!" feel to it. They're ditching stuff for Go for the particular kinds of problems that Go is good at. This is a subtle but important distinction that Zef isn't making, so I figured it was a useful addition to the debate.
- realrocker 12y agoIn my opinion, this comment is a better addition to the debate.
- stcredzero 12y agoThe one big substantive point was about callback hell. Coroutines and channels are exactly what's needed to solve that. Add in a minimalist language design focus on programming in the large, and you have a prescription for what ails Javascript on large projects. This doesn't make Go a silver bullet. (So don't make that mistake, please!) It just happens to be the right kind of tool for two of the more salient problems right now.
- andrewvc 12y agoI agree that callback hell sucks, and promises are a vast improvement, but still shitty. Coroutines and channels are not obviously 'just what's needed' in my opinion however. I think they're part of a larger picture. Mature languages should have multiple concurrency models available for different tasks. Clojure, for instance, supports coroutines, threads, and multiple other flavors of concurrent programming. There is no silver bullet, polyglot concurrency is the future most likely.
- stcredzero 12y ago> polyglot concurrency is the future most likely. One kind of "polyglot concurrency" was the precisely problem of the past! In fact Rich Hickey says himself: You can do concurrency in Java with semaphores and such, but you end up doing some sentinel-thing that's somewhat specialized for your particular subsystem. Then you have to interface with this other subsystem...implement this new feature...then several months later you have a bug introduced because these weren't put together correctly. In a large Clojure project, you should pick a particular way of doing things, then maybe allow a wrinkle or two, then be consistent about it throughout your project, or at least in that subsystem. Maybe you make your entire model an Atom and have a few FIFO queues for information coming in and going out? What you don't want to do then is to mix in transactional memory or Agents. Otherwise you can find yourself back in the "polyglot" mode of Java. With Go, you have a few flexible primitives from which to produce concurrent systems, but the same thing goes here too. You need to pick a few patterns and stick with them. Otherwise you can make your life much harder. However, when you start going parallel, whatever you have chosen can go pear-shaped for some hard to fathom reason. Go is no better in this regard.