Live data from Hacker News

We Don't Hate PHP

hologram.io

41–50 of 85 posts

Re: We Don't Hate PHP

#41
post #29

Those all seem like features any modern programming language has. Nothing here particularly distinguishes PHP from the rest of the crowd. I don't think anyone is surprised by the fact that PHP has classes and some niche methods integrated in most standard libraries. I would like to go one further and say most other more modern programming languages do each of these better. It's always a good idea to look what is beyo…

Furthermore, many of these things were present in PHP 4 or 5 (the 'bad" PHP that many of us remember). PHP 4 already had classes [1]. PHP 5 had PDO. [1] http://www.nusphere.com/kb/phpmanual/language.oop.htm

Exactly. I’d argue what makes modern PHP less awful is almost entirely in what it lacks. Checking a bunch of random OOP boxes is not going to make it a good language. People love plenty of programming languages that don’t check those boxes. (Lua, C, Go are all languages that lack many of those OOP features, for example.)

And to be sure, modern PHP is better. The beginnings of typing, the fixing of horrible standard library behaviors, and an ecosystem with package management are game changers. But to me, all of that means nothing if the ecosystem is primarily running legacy apps. There are clearly proponents of modern PHP that embrace the new PHP, but what really gives it any modern relevance is old school apps like Mediawiki, phpBB, etc. and I feel like they all underscore what I dislike about PHP: not a single problem but a mindset that is incompatible with modern internet. There is no assumption of shared nothing; most apps assume the disk can be used for persistence. And it’s tricky to dockerize a PHP app effectively since you typically need multiple processes; I know there’s work on an app server in PHP itself but last I checked it was for development, and rather I ended up using uWSGIs embedded PHP support as the only solution I could even find that could do this in a way that wasn’t horrifically ugly or intensive.

It still has its issues. For me the prime issue with PHP is the execution model. I am not in for my document root being my source dir. This weird behavior comes from the CGI era and to this day it doesn’t really feel like there is intent to move away from it. Rather, the age old front controller pattern is poised as a “solution,” entangling web server, PHP and application configuration together in some unholy mess, versus the modern pattern of having an app server.

Re: We Don't Hate PHP

#42
post #21

Is PHP still hated on a lot these days? Isn't it just not that popular an option anymore to start new projects with? Most people are aware of the language having changed a lot since its heydays. And honestly, from the article I'm not quite sure why I should consider using PHP. Sure, it has a lot of modern bells and whistles now that it didn't when I last used it 2005-ish, but what makes it stand out? I know a number…

No, because it's not really used for new things anymore. That's why Cobol isn't hated either.

Re: We Don't Hate PHP

#43
post #21

Is PHP still hated on a lot these days? Isn't it just not that popular an option anymore to start new projects with? Most people are aware of the language having changed a lot since its heydays. And honestly, from the article I'm not quite sure why I should consider using PHP. Sure, it has a lot of modern bells and whistles now that it didn't when I last used it 2005-ish, but what makes it stand out? I know a number…

yes it is.

Source: consulted at two companies that survived dot com crash recently, which were PHP shops. They are a node/java shop now. And mentioning PHP will get you fired.

Re: We Don't Hate PHP

#44
post #21

Is PHP still hated on a lot these days? Isn't it just not that popular an option anymore to start new projects with? Most people are aware of the language having changed a lot since its heydays. And honestly, from the article I'm not quite sure why I should consider using PHP. Sure, it has a lot of modern bells and whistles now that it didn't when I last used it 2005-ish, but what makes it stand out? I know a number…

We have a government customer with PHP in their list of technologies that we are prohibited from employing in service of their contract. I thought it was kind of random to single out something that we never intend to use, but in their minds PHP is right up there with Flash as a pariah of the web.

So yeah, there are some people out there who really really hate PHP.

Re: We Don't Hate PHP

#45
PHP to me is a bit like the new Perl. Sometimes you just need a small script that does one thing well. Took me 10-15 minutes to implement an interface for customer support so they can look up a clients last order based on incoming phone number (via Aircall) or name and surname. FTP'd it to an already existing company server and it just works. And saves them weeks of time over a year probably. Nobody cares that I debugged it via die("error");

With Python I'd be stuck reading the latest tutorial on how to deploy virtualenv properly. Java/Spring I'd die of boredom before I figure out where WebMvcAutoConfigurationAdapter wants me to put Bootstrap css this year. Sometimes you just want a quick solution to an easy problem and move on to other things than coding, and I find PHP fits that use case perfectly.

Re: We Don't Hate PHP

#46
post #24

I recently had to work on a PHP codebase. It wasn't a very old one in terms of churn, but it had been around for a while. It was surprisingly clean and well-built from what I could tell, it just got lost in a transition to a new server in a new language. Symfony itself still has some warts in terms of boilerplate but it wasn't difficult to poke around the code. In fact, the most painful bit was setting up on a Mac be…

There's no point in hating a language. A former boss of mine had a saying (which I'm sure he didn't invent, but he definitely lived up to it and I admired him a lot) which was "love the problem, not the tech". He took pride in engaging with any problem to the best of his abilities, regardless of the language. He thought it was pointless to complain about the tech itself; if the tech wasn't suitable maybe it was part of a problem to be tackled rationally, not with hatred.

That said, I'm uncomfortable working with languages which I feel are outdated and get in the way, such as COBOL. You could say I do hate COBOL. I really, really disliked javascript in its infancy; you fought the (lack of) tools and suffered a lot just to achieve something that would have taken you 5 minutes with other languages. This is not the javascript of today, mind you.

One last thing: one should always be wary of the Blub Paradox (one of the best essays by PG in my opinion; I don't particularly like the rest, mind you). People who ignore advances in programming languages tend to look at "their" language, maybe praise its late-coming improvements, and wonder why other people think it's not enough. But it's often not enough indeed, once you learn those other languages...

I've no opinion of PHP because I've never used it.

Re: We Don't Hate PHP

#47
post #36

One advantage of PHP over Node or Java is that it is stateless, so no worrying about memory leaks. And most disadvantages of this disappear when scaling out.

I mean, you generally want node to be stateless too. the DB should be your state.

"Stateless" here meaning that a given process only lives as long as it takes to receive and respond to a single request, as in the classic CGI model (where PHP originated), or like how an AWS Lambda works.

In practice it mainly means that, in exchange for process startup overhead added to your response times, you get to get away with being sloppy about how you initialize and dispose of resources. It's not something I have ever really regarded as a virtue, and it's one reason why PHP devs can have real trouble transitioning to platforms where the same assumption no longer holds.

Re: We Don't Hate PHP

#48
post #11

Laravel is the only reason I'm using PHP but it's a good one. Hands down the best framework I've ever used in any language.

What makes Laravel so good and why can't we clone to a framework in say Python?

I'd say Laravel is a younger, clumsier Rails, based on personal experience of Laravel and having casually watched Rails evolve from the sidelines.

I don't think any Python folks would bother to clone it as most of what it does already has better answers in the Python world.

For example, SQLAlchemy is amazing, and I'd never willingly swap it for Laravel's ActiveRecord implementation.

To be clear, I definitely prefer Python to PHP, having worked professionally in both languages (PHP much more often, and currently).

Re: We Don't Hate PHP

#49

I still prefer using PHP than Java or something else when it comes to write proof of concepts. Nothing can beat features like hot reloading, fast debugging, get things done in a matter of few hours.

As I understand you have probably never used python or ruby ;) ?

Re: We Don't Hate PHP

#50

This is such a surface-level article. Most of the things listed as advantages exist in other languages as well. Here are some actual reasons to like PHP: 1. Java-like interfaces and classes and strict argument (and soon parameter) typing enforced at runtime 2. Autoloading and "lazy loading" of classes means defining bi-directional relationships between classes/types is painless (this can of course also make you shoot…

> you may disagree with some of the things I listed if you don't like the particular feature or design, but that doesn't make them not advantages

Since the above equally applies to you, I suppose you're saying that these "advantages" are a matter of opinion.

Post reply on HN