Live data from Hacker News

I still love PHP and JavaScript

the.scapegoat.dev

61–70 of 402 posts

Re: I still love PHP and JavaScript

#61
Defining good software is hard. Every definition seems to miss something. Including the definition in this article.

It misses that Good Software is cheap to maintain and can easily have features added.

This goal is hard to meet and there are lots of ways to get there. You can get there with PHP and JavaScript but both languages allow developers to create a mess. Don't get me wrong all languages allow developers to create a mess but these are on the end of the spectrum that requires more tooling to avoid a mess.

I'm a huge fan of strict typing. Because I make lots of stupid errors. Spelling mistakes in variables, that sort of thing. My brain seems to function well at the high level of problem solving but no so well at the details (you might be able to tell from my grammar). Strong typing helps me immensely. Many people don't have this struggle so would rather work with a language that doesn't require the same hoops to jump through. They can do it in manually, and it frustrates them to have to setup types that offer them no value. But for me, to build good software that is easy to maintain, I'll lean on the type system. It will help prevent my mistakes.

So I try to avoid JavaScript. It's more difficult for me to maintain than a strongly typed language. I love Typescript as it fills that gap for me.

PHP is not as bad as it's reputation but old poorly written PHP is. I once witnessed a developer come in an update a legacy code base such that it could be tested. I didn't understand why he spent months working on it. I didn't think it would pay off when there were so many important features to get out. His work completely turned that horrible mess into something maintainable.

I guess my point is that new languages are desirable as they can bring down the cost of maintenance. Some of my favorites are TypeScript and F#. TypeScript is a mainstream way to put the training wheels back on JavaScript and F# is like a dream to use. With Fable, FableRemoting and the Elmish architecture I love it for frontend. It's a hard sell because it's so niche but it's great.

Edit: After reading my comment I felt it was more negative than I'd intended. I liked the article and think the author makes good points, I was just adding my two cents.

Re: I still love PHP and JavaScript

#62
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.

[deleted]

Re: I still love PHP and JavaScript

#63

PHP was my main language from 2000 to 2011. I liked PHP 4 very much. "Pass by value" was the default, so it accidentally introduced me to the Functional paradigm, even though it didn't have the memory management to allow for real functional programming. (It did not internally share memory between old and new versions of an object.) I dislike the direction that PHP has taken since the introduction of PHP 5. For the la…

> I don't think anyone would pick PHP purely on the basis of speed, again, there are many languages that are faster.

When it comes to interpreted languages (perl, python, ruby, js), PHP is hands down the fastest.

Re: I still love PHP and JavaScript

#64
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.

In general, how could one know that something has no unknown unknowns? By definition, one wouldn't know.

Re: I still love PHP and JavaScript

#65
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…

Is Hack better than PHP?

In 2022? Probably not. When it came out? Absolutely.

Re: I still love PHP and JavaScript

#66
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

I've always been a fan of PHP too; it was my first programming language that I used to build a shipping application, but saying there are 'no unknown unknowns' in a language as quirky and old as PHP is akin to denying the sky is blue.

PHP 4 + 5 had so many weird quirks, and they lasted a long time because PHP 7 took so long to ship (note there was no PHP 6). When 7 hit, they followed it up with many minor releases to try deprecating/removing/correcting some of those quirks, which itself introduced more unknowns when refactoring legacy code. Suddenly the quirks you were used to for so long were now gone or behaving differently (or more sensibly at least), but this required even more refactoring to account for.

When a language is always changing or evolving you can never know in advance with certainty how new features or changes will change how existing code will work.

Re: I still love PHP and JavaScript

#67
post #47
post #44

Earlier quoted context omitted.

> EDIT: why the downvotes? The anti-PHP cult is strong here on HN. List 5 benefits of React and watch your upvotes skyrocket.

What cult? PHP is technically, objectively inferior to almost every other web technology (which is impressive, actually, given how terrible most web technology actually is) in almost every use case one can think of. That doesn't mean it's bad or that nobody should ever use it, or that it isn't a superior solution in some cases. But in basically any non-trivial use case, it's a poor choice.

Thanks for commenting!

I always have a hard time understanding what exactly is meant with comments like these. We can all agree that PHP has a wildly uneven standard library, had its fair share of security-relevant footguns, tends to have unexperienced developers. That's not extremely different from python and node.js, for example.

The language significantly cleaned up its act, it has had classes, traits, closures, introspection, namespaces, packages for well over 10 years now, a robust third party library ecosystem and many successful projects to build upon (wordpress, drupal, woocommerce, phpbb, etc...). This makes it a pretty good choice for many applications.

The stateless model and the resulting "no crazy stuff" approach makes it a much more reasonable choice for web development than say, python+django or ruby+rails to me. There's nothing I loathe more than trying to find which duck-typing, method-injecting package is causing a slow-burn memory leak in production.

I also don't understand where the "most web technology is terrible" stance comes from. I find the quality of software engineering and the care put into developer UX and productivity in the web world quite inspiring. It has been a forcing function on all programmer tooling since the cambrian explosion in the earlier 2010s.

Re: I still love PHP and JavaScript

#68

> I love legacy codebases. > A legacy codebase means that the product is performing well. It means that I can often make immediate and impactful improvements. Wow. This person must have worked on very different legacy codebases than me. Legacy Javascript code, to me, is something that I do not want to touch with a 10 foot pole, because every little piece of it can be intertwined with and used by many other hidden pla…

> 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?

Re: I still love PHP and JavaScript

#70
post #64
post #33

Earlier quoted context omitted.

> - 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.

In general, how could one know that something has no unknown unknowns? By definition, one wouldn't know.

That's what makes the statement "no 'unknown unknowns'" a bit ridiculous though. How can you possibly assert that there are absolutely NO 'unknown unknowns'? You can never rule them out, and at best can only suspect there's a possibility either way, that they do or do not exist. You can never actually know with certainty.
Post reply on HN