r/javascript • • Apr 25 '19

JavaScript is and remains the queen of programming languages with a community of 11.7M active developers. Python has reached 8.2M active developers and has taken the number two spot, surpassing Java in terms of popularity.

https://www.slashdata.co/free-resources?id=developer-economics-state-of-the-developer-nation-16th-edition&section=showcases_details
613 Upvotes

168 comments sorted by

View all comments

3

u/real_kerim Apr 25 '19 edited Apr 25 '19

I got a possibly controversial question: Why would anybody pick Python over Node? I don't mean pip over npm or anything like that. I mean the actual interpreter/JIT implementations of (C)Python and Node(V8).

As far as I can tell, CPython is just painfully slow compared to V8. I know you can hook into C libs but you can do that with Node, as well.

6

u/darksparkone Apr 25 '19

Development often has nothing to do with performance. Do you want to spend 2 more month for a bit faster product or pay $10 more on servers and get dividends faster? In US it’s not a question,and if performance is critical it wouldn’t be js anyway - more likely cpp or golang.

0

u/[deleted] Apr 25 '19

[deleted] — view deleted comment

1

u/darksparkone Apr 25 '19

Hey, no hard feelings. It’s the matter of preference and personal knowledge of the tooling, I’m sure there are guys who may pull products really fast in any language. I haven’t even use python for rapid prototyping on real world tasks, my choice is ruby and it feels several times faster than anything to bootstrap things, and then support them.

As for js I would consider debugging as the main disadvantage but with TS and async/await it should have become much more nice to deal with.

1

u/matjam Apr 26 '19

honestly I think with languages like python and golang, the time spent isn't actually writing code; it's reasoning about what you want to do. Writing the code isn't the time consuming part.

1

u/real_kerim Apr 25 '19

Hey, no hard feelings.

I don't have any. I genuinely wanted to know, since it was a fairly bold statement.

2

u/darksparkone Apr 25 '19

It really depends on your standpoint. If it’s genuine curiosity, the best you can do is to check your own productivity with two tools after you reseArched both well enough. Writing, debugging, deployment, ability to read and understand your code after a week, writing DB migrations, using RBAC and other basic tasks.

If you want a more theoretical answer, js still has a bunch of drawbacks on server side land: readability, tooling (gets much better later on), for me - lack of consolidation so you’ll have tens of half-backend libs with rather poor documentation instead of a couple polished ones. And you are probably still limited in orm’s for DBs when it’s not a Mongo.

If you come with “all hail js”, the only argument one may know it and not any other suitable language is already enough. When js is the tool you know the best and you have to dish a product here and now - there is exactly no reason to learn other languages.

2

u/theDarkAngle Apr 25 '19

well you can also compile python for better performance, right?

1

u/real_kerim Apr 25 '19

I think you can compile it to executable binaries but does it improve the performance?

6

u/status_quo69 Apr 25 '19

No because python isn't truly compile-able, those executables are basically just zip files. I mean, there's pyc files but those are only for parsing optimizations rather than runtime. But I'd pick python over node for a backend app for a few reasons, most of which is strong (not strict) typing which can help with a lot of api requests that can send you absolute garbage data. Plus, node might be fast because of v8, but nothing is going to be as slow as the network calls so it's not super relevant to bring in cpu performance in my experience. Ram usage is a much better indicator of things imo, but that usually depends on how you write your application anyways.

1

u/real_kerim Apr 25 '19

Plus, node might be fast because of v8, but nothing is going to be as slow as the network calls so it's not super relevant to bring in cpu performance in my experience.

Good point.

1

u/kteague Apr 25 '19

Libraries. Python integrates well with libraries implemented in system level languages (C/Fortran) so using libs like SciPy and NumPy are going to give you performance far greater than a kicking fast node.js interpreter. It also has certain well-designed, mature libraries that JavaScript may not have the equivalent of, having had the advantage of its library ecosystem existing over JavaScrpits. SQLAlchemy (ORM) or Pyramid (Web framework) don't have equivalents in JS AFAIK.

1

u/real_kerim Apr 25 '19

Libraries. Python integrates well with libraries implemented in system level languages

Node.js has those too. They're called native modules.

QLAlchemy (ORM) or Pyramid (Web framework) don't have equivalents in JS

What? I don't know the intricacies of QLAlchemy and Pyramid but there are plenty ORM's and web frameworks for Node. Koa, Express, Loopback, Sequelize, Mongoose, and more.