Live data from Hacker News

I still love PHP and JavaScript

the.scapegoat.dev

241–250 of 402 posts

Re: I still love PHP and JavaScript

#241

Earlier quoted context omitted.

> never found a legacy JS codebase that has a robust test suite, so any refactoring I do can be hard to test and verify. Wouldn't you just... make a test suite?

If there is no pre-existing test suite, it is extremely difficult to know what is the right expected behavior that should be tested, and what is incidental to the implementation.

Hopefully there is a product team or actual internal users you can interface with to know the expected behavior. I'd expect to at least be able to write some integration-style tests that can ensure everything works from the user's perspective.

If you're so disconnected that you don't know the user's perspective or have no way to see the program in action, then ..best of luck!

Re: I still love PHP and JavaScript

#242
post #4

PHP has so many hidden benefits: - it's stateless by design (much easier to scale) - it was "serverless" before Serverless - surprisingly performant - no "unknown unknowns". it's so tried-and-true, there's no surprises - deployment is so simple, just drop a file on a web server. No middleware needed. - No long compile times because there is no compiling needed. EDIT: why the downvotes? If you don't agree, just reply…

> I feel like PHP documentation is very undervalued PHP is documentation done right because of the comments, essentially "Stack Overflow" for PHP before stackoverflow.com was a thing. I've found an example of documentation done wrong recently with Microsoft .NET 6.0. Apparently, Microsoft has decided that code samples are no longer important

This can go both ways. I have seen some very dangerous code examples in the comment section of the PHP docs.

Re: I still love PHP and JavaScript

#244

Earlier quoted context omitted.

I’ve always wondered why the more respectable dynamic languages, like Ruby and Python, don’t have a web framework with the PHP deployment model of “just upload this file to the server and refresh your browser to see changes.”

They do. It's just that everyone seems to have collectively decided that cgi shouldn't be used anymore.

CGI has become "serverless" and it's hyped up to no end. The more things change, the more they stay the same.

Re: I still love PHP and JavaScript

#245
post #208
post #87

Earlier quoted context omitted.

But genuine question -- what other languages are as simultaneously as useful AND predictable?

Ruby, Python, C#, Java, and JavaScript are all are more predictable and just as useful. Go, Elixir, Clojure, and probably others are more predictable while being less "useful" only in the sense that they may have less convenient deployments or less mature web libraries.

I've used Python, C#, Java, JavaScript and PHP, and in my experience Python is the most unpredictable of these languages. Just to name a few: - mutable default arguments - late binding closures - typings that are purely documentation instead of being enforced

Labeling these things as "gotchas" doesn't make them predictable imo.

Re: I still love PHP and JavaScript

#246
post #33
post #4

PHP has so many hidden benefits: - it's stateless by design (much easier to scale) - it was "serverless" before Serverless - surprisingly performant - no "unknown unknowns". it's so tried-and-true, there's no surprises - deployment is so simple, just drop a file on a web server. No middleware needed. - No long compile times because there is no compiling needed. EDIT: why the downvotes? If you don't agree, just reply…

> - no "unknown unknowns". it's so tried-and-true, there's no surprises This part is laughable. People who have been programming PHP for 20 years (several of them at my company) still routinely discover hidden bugs, quirks or general behavior that is totally unintuitive and nowhere found in the documentation.

Like what? Come on, if it's that common you must have at least one example.

Re: I still love PHP and JavaScript

#247
post #11
post #3

I love PHP, it fits that niche of having a fast startup like Perl, while having a big standard library like Python. However after using Go and Rust, I don't like the idea of the package manager being this separate thing (Composer). I think the package manager should be part of the PHP distribution itself, not some other thing that people have to find and install separately. I am fine if people want to implement other…

Composer is the de facto package manager for PHP. I’ve never seen anyone try to compete with it. I also don’t believe a bundled package manager is necessary — NPM isn’t bundled with JavaScript, and it seems to be doing ok.

> Composer is the de facto package manager for PHP. I’ve never seen anyone try to compete with it.

According to common PHP culture, there's no need - since it's already good enough. Instead of re-inventing something you can just move on and get your own sh*t done. :)

(edit: formatting)

Re: I still love PHP and JavaScript

#248

Earlier quoted context omitted.

I’ve been using PHP since 2003 and it’s my full time job and this doesn’t ring true. Very, very rarely is a gotcha not in the docs comment section.

i always found those comment sections to be so odd — fifteen year old comments about a common pitfall and the information never makes it up to the official documentation? i suppose it's fitting for a web-centric language to crowd source its docs on a website, but does any other mainstream language do this?

Meanwhile, I find the PHP docs far more readable/accessible than almost any other language. Compared with the official Python or (shudder) Java docs, and they're far superior, IMO.

Re: I still love PHP and JavaScript

#249
post #149
post #87

Earlier quoted context omitted.

But genuine question -- what other languages are as simultaneously as useful AND predictable?

Python covers many of the same use cases and is much more consistent/predictable. TCL if you want to go back a bit further.

I've never experienced the same kind of out-of-the-box problems with PHP as I have Python. I seem to suffer constantly from python/python3, pip inconsistencies and stuff just breaking constantly.

Re: I still love PHP and JavaScript

#250
post #3

I love PHP, it fits that niche of having a fast startup like Perl, while having a big standard library like Python. However after using Go and Rust, I don't like the idea of the package manager being this separate thing (Composer). I think the package manager should be part of the PHP distribution itself, not some other thing that people have to find and install separately. I am fine if people want to implement other…

On the other hand JS now has many package managers yarn, pnpm and even competing runtimes deno, bun that include their package managers and have often incompatible code. Composer is atleast undisputed, embraced and works well. Anything PHP is on there. Package formats are unified not like in JS. Pythons PIP is also separate project.

Python's pip is developed separately, but the main repository is operated by PSF (authors of Python), and python's source code nowadays contains the "ensurepip" module to install pip if needed and official binary releases contain pip directly.
Post reply on HN