The PHP Singularity

I don’t think I’ve ever read an article so off base, or one that generated such a visceral response of disgust. PHP is a very usable programming tool, and I’ve built thousands of apps on it over the years (from the very beginning). Use what you want, but leave my tools alone! Keep your bigotry to yourself.

Inoryy: if your take-away from Munroe’s and others comments about PHP is that they didn’t explain why PHP is so bad then you didn’t read those articles. Munroe is very explicate with exact cases why PHP is a Bad Language. I could easily use your refutation tactic and say that just because everyone uses it doesn’t mean its a good language (which actually in my opinion is a completely valid argument). PHP is a bad language and 20 years experience using C/C++/Java/Perl/Shell/.NET will make it patently obvious to you. I’d still rather use perl before picking up the old double-clawed nightmare that is PHP.

Hey, Maybe you think PHP sucks, and maybe it does. If PHP does suck, it’ll disappear whether you destroy it or not. It’s better that time verifies it , not you~

What’s so great about having HTTP methods built in? In other languages you simply include a library it’s hardly an advantage to have those methods build in. If anything it’s a disadvantage as it means your core includes crap you don’t always need.

I don’t enjoy PHP that much either, it’s just so ubiquitous among web development that it’s nearly unavoidable.

Jeff wrote:

I’m starting a new open source web project with the goal of making the code as freely and easily runnable to the world as possible. Despite the serious problems with PHP, I was forced to consider it.

So was that project these discourse forums?

Matt

1 Like

It was. But I decided I didn’t want my children to have to learn PHP, and I couldn’t in good conscience perpetuate the problem.

Have I mentioned that the Discourse install is under 30 minutes now, and we have a one-click updater courtesy of @sam_saffron?

Not as good as it could be, but pretty damn good for 1 year of public work, I think.

The forum software itself may be easy to install. But for the actual hosting requirements it went from

truly compete with PHP in ease of installation and deployment

to Postgres, Redis and Ruby. That’s not even remotely comparable in ease of hosting IMHO. Which probably is one of the reasons PHP is still on top.

The best way to fix the PHP problem at this point is to make the alternatives so outstanding that the choice of the better hammer becomes obvious.

I know this is an old post, and I’m not sure if this is mentioned in the voluminous comments above, but one thing I really like about facebook is that rather than write about how awful a language is, or spend immense money and effort switching to the flavor of the day (eBay, Twitter), they adopt the Japanese Kaizen idea and continually improve the tools supporting PHP. First they created a PHP compiler, and if that didn’t blow you away, they then created a VM, and if that still didn’t impress you, they now have an entirely new language.

Hack is a programming language for HHVM that interoperates seamlessly with PHP.

How cool is that? So while everybody else was complaining, and I love how facebook just marches forward. Sure, there is the creepyness aspect to the company, but their technology sure impresses me.

This is another example of what a coworker called " Intellectual Correctness " that is spread in the software industry.

The tool may be working right and well, but if for a someone is not " correctly " in a intellectual fashion , so doesn’t work. He gave me an example: " A mortal user / ordinary person needed to hammer nail on the wall. The only tool he had was a rock. So he used the rock and he succeed to hammer it well. Then a software developer came and he saw the work done. The nail was well placed on the wall. But despite that, he said: " It’s wrong, because you didn’t use a hammer ".

I agree, PHP is a ugly language. VB is criticized, but you know what ? Who cares !!! Is not the language itself, and at the end is how you used it. We are developing tools, not writing pieces of literature.

PHP is damn easy to use, learn, install and deploy. And you can work with it right out the box. That’s why is widely adopted. And all the major and popular web apps like wordpress, joomla, phpbb ( and even facebook ) are written in PHP.

I coming back to this post because I’m giving a try to your brand new finished Discourse app. Let me congratulate you and your team because you did that great work in the client side.
But I’m going to quote some subject you mention in this post:

The best way to combat something as pervasively and institutionally awful as PHP is not to point out all its (many, many, many) faults, but to build compelling alternatives and make sure these alternatives are equally pervasive, as easy to set up and use as possible.

So you decided to built it in Ruby. I have to say, I’m not a Ruby developer nor Linux enthusiast. I have 15 years in the field and I don’t want to spend more time learning yet another programming language just for the sake of the "intellectual correctness ". May be its because it’s version 1.0, but having to download a virtual machine, running another set of tools and learn all that stuff to give a try ? Anyway, I did it and doesn’t work.

Maybe PHP is ugly but you know what ? I can download Joomla or WordPress, get it done in minutes, work on it in Windows and put it in my host right away.

1 Like

Speaking of Composer, it’s another crime from PHP community! I don’t think people whom wrote that went and read any other packaging system.

For crying out load It’s slow and inefficient!

Even people in JS community did much better job with npm!

Look, just because you don’t want to learn better tools doesn’t mean that these tools aren’t better. If you don’t want to install Discourse because maintaining it might involve learning new things, then don’t.

If that hurts adoption of Discourse, that’s a price that the Discourse team is willing to pay to try to drive adoption of a better language and a better environment.

I don’t think that “PHP is ugly but at least I know how to use it” is really a valid argument, at least not for the quality of the tool. Just because YOU have a tonne of experience working with a byzantine mess of a language, that doesn’t mean that it should be the standard.

I agree, PHP is a ugly language. VB is criticized, but you know what ? Who cares !!!

We do. We all do. That’s why we’re here.

Hi, guys. I am - a PHP developer. *Thunder*

Thing is, I also consider myself a pretty talented developer. Bold statement, huh?

Well - I’d like to let my code speak for myself, and to let you guys be the judges.

Please check out this project I’ve been working on for the past couple of months.

This is a library and Symfony 2 bundle that uses a Doctrine 2 entity map and a RAML API definition to conjure a HATEOAS API, following the JSON-API specification.

Would it be prettier in Ruby, or Clojure? Yeah, I think so.

I was aiming at a specific need for a specific platform; the Symfony 2 framework. The important thing is - I don’t think the code displays any significant symptoms of the rampant illness you folk seem to think PHP spreads.

I’m a good dev, hence, I can take a decent lang and make good code with it.

Could I have done this with PHP4? Nah. Not even with PHP5.2. But, nowadays, the old elephant is quite a different animal altogether.

Please take the time to check it out. You might just get even better argumentative weapons to blast me off.

Cheers.

I could not agree more. After observing the precise grammar and punctuation in the authors first few opening sentences, I knew where this was headed.

However, I might also point out that most anyother server-side scripting language is similar in fashion:
ASP.Net is not a language as much as a platform with similar functions. While ASP.Net does integrate well with SQL Server. ASP.Net and SQL server are not ideal for small business.

True, JavaServer Pages are probably way better from a precisely defined perspective… But does using JavaServer P. because its superior and better refined make sense for a small business owner who just wants a to track user information, and make a site a little modern with custom active pages?

It works like this:
If you own Amazon use JavaServer Pages
If you need an Intranet for remote employees are P.C.I certified and can afford to hire an decently skilled I.T. staff - go A.S.P.

If you’re a small business owner with web hosting, go P.H.P and MySQL.

Why?

JavaServer is best for a huge enterprise and can cost a lot to shine over P.H.P, and ASP solutions…

M.S. I.I.S. with A.S.P.Net, properly licensed is a lot of money as well. Not to mention the hardware to run it.

P.H.P and MySQL can offer more solutions, and more people can afford to learn them.

Yea “better tools” mean have to spend 30 min installations, have to use a – virtual machine – to only try discourse and another bunch of unnecessary things ? ( And I repeat virtual machine !!! )

Go and try install any installation of wordpress, joomla etc. Install Xamp put the application in the directory and that’s it. No less that 5 min.

Its not ABOUT the tool but HOW you use it.

It’s been 3 years since this post was written. @codinghorror how far are you on your quest to kill PHP? How close are we to the singularity? Maybe in 3 more years you can succeed. Meanwhile, PHP7 is coming out.

I think what’s worse than “bad” programming languages are people who feel any need to lambaste them. I know this is an old post, but what a sad thing to have to read from you.

Well, you know, COBOL is still here, and people still code in it.

Doesn’t mean it’s a good choice.

I do understand the appeal of PHP to non-programmers who want to become semi-programmers and whack up something (more or less) working in a day, personal site, WordPress blog, without knowing (or caring about) what they are doing. But it’s uncomprehensible why/how PHP found its way into corporate environment. Where this (I try to be delicate) ugly language is regarded as a proper tool for paid programmers to use. :scream: Of course, it’s hard or impossible to break away from PHP if it is everywhere, and most jobs are still PHP. Vicious circle.

Why is PHP so popular for the web?

It solves the most problems for the largest amount of people for the least amount of money. Quite simply, it’s economical. Very few ventures, whether they be personal or business require the structure / strictness that many other “respected languages” enforce. PHP is capable of being as good as the programmer who writes the code (not an original argument on this forum, but it has it truths). Albeit it has a low barrier to entry, this doesn’t mean you cannot write elegant, DRY, and testable solutions that implement SOLID practices. PHP’s biggest fault is it doesn’t require a team of bona-fide computer scientists to be able to solve problems with it and be able to fall asleep at night.

PHP is just functions…

This statement is out of date, and most of the people reading this already know that. That aside, I enjoy the multitude of functions that are available and the succinctness and read-ablility that can be achieved with the code. Before your rebuttal, it should be said that programmers can write half-ass solutions that don’t respect CPU time-complexity just as easily in Java as they could in PHP or any other language.

PHP isn’t strictly typed.

Many people don’t consider this a problem, but for those who do it can be combatted (if you want it to be).

PHP doesn’t provide reasonable error handling.

This has never been something I considered a problem, use a library, or any framework, or var_dump(debug_backtrace()); and figure out how to write your own in an hour.

Someone ripped on composer for being slow…really?

Was the 10 seconds it took to composer require or 30 seconds it took composer update longer than it took you to write a half-baked solution, vetted by no one, and containing no documentation? Composer is one of the best things that happened to PHP’s maturity and relevance, especially amongst a bunch of angry programmers who pride themselves of principles instead of productivity.

Lastly, people who work in PHP also enjoy making fun of it time to time. They also enjoy going home on time or continuing to write a personal project in it when they go home. They enjoy getting things done. And they enjoy mentoring other people who are just getting started.

You could just add Python to your server stack and then use PHP to run your Python scripts instead. Problem solved. I think PHP is still very useful for inline dynamic changes if you don’t want to use a server-side js like node or Meteor.