Hacker News new | past | comments | ask | show | jobs | submit login

I think it’s the culture. The code quality of almost every PHP project I’ve seen is atrocious. I’m not saying every JS project is perfect (far from it), but amazingly well-written JS projects are ubiquitous.

So when I ask myself “how much do I trust complete strangers on the internet?” the answer is “not much, but even less than that if it’s written in PHP.”




> amazingly well-written JS projects are ubiquitous

I'd genuinely love some examples.


I've always loved this project / product:

https://github.com/outline/outline

I think the guy who built it posts here. There's also pg-promise, a "Postgres interface for Node.js":

https://github.com/vitaly-t/pg-promise



I mean, those are popular, but what makes them well-written? What do you see in them that makes you say those are amazing projects?


I think at this point we can all roughly agree on what makes code well-written?

1. Stylistically consistent for things like format, naming, control and logic flow

2. QA: linted, unit tested, code reviewed

3. Design: Modular, scalable, future proof, secure, stable, reliable, performant etc.

4. High adoption implies testing/verification of above design attributes

5. Follows (or establishes) best established practices for interfacing with platform APIs etc.

6. Keeping complexity low enough that a junior engineers can contribute

7. Descriptive commit messages

etc. etc.


Instead of pure code try seeing it as a book. If I read a book with a lot of spelling/grammar errors, a story that goes nowhere, characters that aren't interesting to me, plots that make no sense, etc..., then I'd tend to think of it as a not well written. Same with code, if variable names are obscure, function names don't match what they actually do, needless abstractions, nonexistent documentation, no tests, etc..., then I'd tend to think of it as a not well written project. Those aren't the only things I look for, but that's a start for me.

One could also argue, "why does it matter how it's written, it's not a book and it does what I need to do so that's fine." If it works and you don't have to do anything, great. If you have to troubleshoot it because it broke, then hopefully the code is structured in a way that lends itself to debugging. Otherwise, you might end up having a bad time.

For myself I'd say the lodash repo is well written. Would you agree/disagree?


My impression from when I read a big chunk of the React codebase to confirm some suspicions about how they'd implemented hooks ("wait, if that's how these behave, does that mean they... no, surely they didn't... well, yep, that's exactly what they did") was that it had more layers of abstraction than would be ideal and was a bit under-commented, but not awful.




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

Search: