Live data from Hacker News

Leaving Python for JavaScript

hire.jonasgalvez.com.br

21–30 of 112 posts

Re: Leaving Python for JavaScript

#21

I started programming in JS then moved to Python. It seems like JS has become very, very complicated. I look at his post and I am lost... I remember Knockout.js and Node in the v0.8 days. I mean look at this: dotenv (lets you load the environment from an .env file), axios (HTTP client library), cheerio (HTML parsing library), bcrypt (password hashing), co-body (HTTP body parser), co-busboy (HTTP multipart parser), js…

I have been in your position about a year ago. The approached that helped me, was to not worry about all this.

Just start somewhere; and in a month or two, you would mostly know which libraries you need to add to your project.

The best way to go about it, is to check a few popular open source projects; what libraries they typically use.

> I am also asking if any of those libraries will be around in a year?

You can check the download stats of these in https://npmjs.com, and activity on the GitHub repo, before adding it to your project.

If they are still around, but have published a new major version to update a few APIs; you can slowly migrate to it.

If not, you'd read some Medium post or Hackernews discussion, about what is replacing that.

There's something called Greenkeeper (https://greenkeeper.io/) that integrates a GitHub bot to your repo, and files a PR when something needs to be upgraded.

You can implement something similar on your own, if you aren't interested in using something like this.

Re: Leaving Python for JavaScript

#22

I started programming in JS then moved to Python. It seems like JS has become very, very complicated. I look at his post and I am lost... I remember Knockout.js and Node in the v0.8 days. I mean look at this: dotenv (lets you load the environment from an .env file), axios (HTTP client library), cheerio (HTML parsing library), bcrypt (password hashing), co-body (HTTP body parser), co-busboy (HTTP multipart parser), js…

Apparently it's just the guy's routine JS rig, not any sort of new standard you would have to follow or even care about.

Re: Leaving Python for JavaScript

#23

I started programming in JS then moved to Python. It seems like JS has become very, very complicated. I look at his post and I am lost... I remember Knockout.js and Node in the v0.8 days. I mean look at this: dotenv (lets you load the environment from an .env file), axios (HTTP client library), cheerio (HTML parsing library), bcrypt (password hashing), co-body (HTTP body parser), co-busboy (HTTP multipart parser), js…

Most of the Js libs are super tiny. You integrate them, learn what you need to learn in less than 10min. Each is like learning a numpy operation :). It has its benefits and problems, but it's for the better imo.

Re: Leaving Python for JavaScript

#24

I started programming in JS then moved to Python. It seems like JS has become very, very complicated. I look at his post and I am lost... I remember Knockout.js and Node in the v0.8 days. I mean look at this: dotenv (lets you load the environment from an .env file), axios (HTTP client library), cheerio (HTML parsing library), bcrypt (password hashing), co-body (HTTP body parser), co-busboy (HTTP multipart parser), js…

> What the hell is all that?

Libraries of code.

> I am not saying he is wrong...

Good, because they are right.

> I am just saying that I don't have the capacity to play in that playground

Good, because you are right.

> I am also asking if any of those libraries will be around in a year?

Yes. Some have been around for years already.

Listen, it's fine that you are using Python. It's fine that the OP is using JavaScript. It doesn't make you wrong. It doesn't make them wrong. Just because you are confused doesn't make it wrong. Hell, Python should worry about itself; it has enough warts of it's own it doesn't need people pretending that a library like bcrypt is confusing.

Re: Leaving Python for JavaScript

#25
I want to like JavaScript, but the type coercion land mines and the lack of a real numeric tower make me a little queasy. When I have to use JS I stick to the transpile-to-js languages mostly for those reasons.

Re: Leaving Python for JavaScript

#26
post #18

> there's no acceptable way to pass a function body to another in Python. There are sentences which are telling a huge incompetence about the person using these. This sounds the same story to me as "We used tech X, but X is shit/can't do something so we switched to Y, and Y is awesome and fast." Where the person switching was just incompetent with X but it would have been perfectly solvable and they just do a totally…

No one likes callback hell but I believe they meant that you can just pass a function expression directly. No need to define a named function. It's the difference between:

  let doubled = nums.map(x => x * 2)
and this:

  def double(x):
    return x * 2
  doubled = map(double, nums)
(my Python is pretty rusty so maybe there's a better way of doing that)

Re: Leaving Python for JavaScript

#27

I did the move but to GOLANG instead. I think what is more important than the language it self, is the toolings and standard library. every now and then you hear about a new framework, a lot of hype, which is not for big projects. I think the wise thing is to move to golang

Why? I mean please elaborate.

Re: Leaving Python for JavaScript

#28
post #18

> there's no acceptable way to pass a function body to another in Python. There are sentences which are telling a huge incompetence about the person using these. This sounds the same story to me as "We used tech X, but X is shit/can't do something so we switched to Y, and Y is awesome and fast." Where the person switching was just incompetent with X but it would have been perfectly solvable and they just do a totally…

The way I see it, there are two types of callbacks - synchronous and asynchronous.

This is a synchronous callback (but callback nonetheless), that takes an array of numbers, and adds its entries:

arr.reduce(function(acc, item){ return acc + item; });

There's some boilerplate in this, so as per latest JS specs, you can remove all that and rewrite it as:

arr.reduce( (x, y) => x + y);

Then there's asynchronous callback. Most of "callback-hell" stems from these type of callbacks, because you would do "do-this-then-do-this-then-the-other-thing", and nest these one within other.

We realized that callback-hell prevents us from using return or handle errors in a clean & reliable way, so we went to promises.

Then promises turned out to be quite a pain too. Then generators, and now we have settled for async-await.

But in no way that "hell" is acceptable!

Re: Leaving Python for JavaScript

#29
Just in case the author is present in the thread:

Your blog is extremely difficult to read on wide screen monitors. The entire left 50% is basically just blank space. My suggestion is to make the left side maybe 20% width on desktop or less.

Also, regarding the article content:

There really aren't any good reasons presented here about why you moved from Python to Javascript for back-end web development. It seems that you simply prefer Javascript semantics. There's nothing wrong with that, but the title is misleading considering that the bulk of the article is actually about which JS tools you use on recent projects and not why you moved.

Also, could you clarify what you mean by

> Also, there's no acceptable way to pass a function body to another in Python.

Functions are first-class in python and can be passed as arguments to other functions. I'm not sure I understand what you mean with the above statement.

Cool to see someone else has been using Nuxt though.

Re: Leaving Python for JavaScript

#30
I was going to suggest that the you have to be lobotomized to do something like this then I remembered that perfectly OK folks decide to go to places like North Korea (and come back lobotomized) so now I only suggest that you must be extremely inexperienced to dump python for javascript...I mean js doesn't even have a proper stdlib nor any means for quality control over what gets into the npm archives. No wonder that you have a new library for X in every week just to be forgotten the next month.
Post reply on HN