3 ms·
Ask HN: Should I learn Node.js or Python?
I'm in the process of developing specs for a system that will be using Go and PostgreSQL its functionality.
There is a part of the system that will ideally utilized AWS Lambda and another part that will require some logic within PostgreSQL functions/procedures.
Lambda AND PostgreSQL functions support both Python and Javascript. In an effort to minimize the long term support burden for anybody else who picks this up at the company, I'd like to use the same language for both parts.
What should I use and why?
- PythonDeveloper 11y agoYes. Learn both. Python is great for system development as it's on virtually every platform by default (as is Perl btw), and Node is great for server development. Python is also good for server development, but it's not as easy to implement a functional server in Python as it is in NodeJS. The two work together beautifully. I would learn NodeJS first, then python using the flask or bottle frameworks (Django is very good, but also very heavy). Cheers!
- bnchrch 11y agoHaving worked with all of the above besides Lambda I think I can offer some points to help with your decision. It would be nice to know what kind of work was being done with Lambda but oh well. Using Python will give you better readability, more battle tested libraries, a more robust set of tools for data/number processing and (this is the kicker) a much easier time interoping with Postgres, specifically it's stored functions and procedures. Using Node will give you a better paradigm for evented I/0 tasks, be quicker with basic I/O tasks, more experience with javascript (don't underestimate this), a larger pool of people who will likely understand this as this is typically the first if not the second language web developers learn, but as a downside node comes with a rapidly changing eco system so what you write could become out of date very fast and the asynchronous nature of it all can make the logic much harder to follow. Both are quite popular and enjoy some amazing communities behind them, so you'll be fine in whatever you choose.
- brightball 11y agoThank you! Great feedback. Lambda is just going to be handling logic to receive some reporting emails from an outside system (via SES incoming email). It will just be storing the entire message payload in S3 and notifying another system that a new message has been received. These reports are expected to be infrequent (maybe a dozen times a day).
- tefla 11y agoI would just caution you that, node/JS has a much greater learning curve when starting out. However once you have gained knowledge of the different libraries (i'm thinking Promises, Async, lodash) and asynchronous patterns, you can write very powerful code in very few lines of code. Python on the other hand; you will be able to get up and running, and implement large portions of the functionality that you require in your script, very quickly. The downside comes when you need to worry about optimisation. Without a lot of experience, it can be hard to find out how to go about making Python code fast. At the end of the day, both are great languages, and have great communities.
- brightball 11y agoThank you. Since performance isn't going to be a huge concern with the spots that this code is used but learning curve is, I've settled on Python. Additionally, since the more intensive side of this will be in a database the math and analytics libraries add some real value. We're using Go for the rest of the microservices and can always revisit the Lambda code if performance becomes a real concern. It's going to be so small that rewriting shouldn't be much of a concern.