Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Why Node.js makes me uncomfortable
4 points by cannibalXxx on Oct 11, 2023 | hide | past | favorite | 9 comments
I've always programmed with php for the web and during that time I've never needed to download packages (like npm) and update them. When I needed a specific function, like sending emails, uploading files or making my application drier, I just had to look at the documentation and implement it. But with node.js it doesn't work like that, and that bothers me. If I'm wrong, please correct me


It's true that having a lot of dependencies brings it's own problems. I worked with PHP and other tools for years that were more "batteries included" and that has it's own pluses.

However, and I know this an unpopular perspective, but I believe that easy-to-access libraries via package registries was actually the greatest advance for software engineering ever. Because it took code reuse to a new level.

Take a look at Deno and Bun if you want to get into JavaScript but rely less on packages.

I suspect that Rust and other languages that can be compiled to web assembly will continue to pick up momentum though.

AI may push towards more buttoned-up platforms however, since that makes it easier for AI to generate code that works.

But where we are heading eventually may be specialized agents coordinating to do the programming and eventually to some degree just handling some interfaces live or automatically configuring interfaces between systems or subsystems.


PHP does come with an incredible amount of functionality out of the box. Though that does not mean one may never have to intgrate a library.

That being said, the dependency insanity which became commonplace with JavaScript becoming more accepted as backend language is a different story of course.

Was it left-pad? :)


:D


There is nothing stopping you from writing your own original functionality for Node. There is also nothing stopping you from downloading packages from places other than NPM, such as Github. Lastly, you are not forced to use NPM in projects of your creation.

It sounds like you viewed some tutorials and made some assumptions.


I've ranted about this several times: https://news.ycombinator.com/item?id=34539716

Node has its advantages for sure, but it's very different from PHP (especially if you're using a framework like Laravel).

You're right that you get much less out of the box and often need to use packages. PHP is kinda weird though... It does a lot out of the box and PHP frameworks also take that approach. For example, Node.js's Express is really just a basic web framework, Laravel on the other hand provides everything from templating, validators, email, auth, etc.

Node really just provides the JS runtime environment and leaves everything else up to user. And that's nice in some ways because there's less "magic" going on and it makes learning Node very simple. But the trend off there is that if you need to send an email there's not some magical method you can call that just works. Instead, you need to install a package or you build something yourself.

I find Node applications more interesting to work on personally. You find different projects often take different approaches and will use slightly different packages depending on the requirements. PHP projects on the other hand always feel very similar to me and I feel less free to have opinions on how things should architected.

Anyway, you're not wrong. Node is just different and we programmers tend to automatically dislike difference because good code is generally code tends to follows recognisable patterns.


You could always fork packages (or make your own) if you don't want to use the open source stuff.

I love the node ecosystem, personally. Way less reinventing the wheel for basic things. But I do wish there was a curation/vetting system for them. I bet there's a ton of malware floating around that we don't notice... :/


Yes, it is


What are you building? Are you making complicated web infrastructure or building a random website for an online towel store? There's more than 1 valid approach to building good software. Node.js and PHP have very different approaches with different tradeoffs and have different strengths for different problems. If you're more comfortable with PHP, no worries, use what feels right to you.


my biggest fear in all this is the malware spreading around :/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: