34 comments

[ 3.3 ms ] story [ 73.9 ms ] thread
Writes "This post isn’t really about Java vs. PHP" then spent three quarters of the article doing just that.
The entire initial arguments of this article are just argumentum ad populum. Just a bunch of bullet points about popularity, finished up with the same round of "good programmers write good code in any language." So, does that include Java, then? No? Ok.

PHP is "designed for the web?" What does that even mean in this context? They never really explain it beyond saying PHP is tightly coupled to your webserver (which is not objectively a pro, not even close). Knowing my early history of PHP, it was originally closer to "cobbled together to get something to work for the web."

There seems to be a weird, baked in idea that Java software is always bloated and PHP software cannot be. In other words, it's predicated on a language-agnostic idea, but it's applied directly to two languages.

After all that, I find this highlight particularly hypocritical, since the article never actually offers any real benefits to PHP beyond "it's popular" and "it's for the web":

> Letting someone sell you on a language (like Java) without having a full evaluation and discussions about architecture and design is like letting a home builder sell you on buying a house you’ve never seen because his contractors use only the latest and greatest hammer (or sledge hammer in the case of Java EE).

It is an annoying click-baity title, but his point is that you could replace Python or Ruby with PHP.

You then lose the popularity argument that comes with PHP but the rest of the article I think is still relevant.

But if you remove the click-bait part of comparison between the languages, there's not a lot of thing left.
We are no longer living in the days of EJB 2 and Websphere 6. Springboot allows you to get started quickly with out spending a week configuring your app server and Java beans. The article should have been titled "Using enterprise Java technology from 15 years ago will kill your startup. PHP will save it."
Seconded. Even bare Java EE development hardly needs XML configuration anymore, since about EE 7 (maybe 6?).
At least with my work Java EE 6 and WebSphere 8 brought pretty decent annotation support. WebSphere Liberty looked pretty nice from the little I used it, but that was several years ago.
It has been started with Java 1.5/5, 14 years ago.
I keep waiting to get cynical about Spring Boot for some reason (maybe once the next conceptual breakthrough which looks obvious in retrospect happens), but honestly it's the breath of fresh air and simplicity that the JVM ecosystem needed, and it has literally turned writing Java weba apps upside down (err..inside out?) in the best sense possible.
if you like Spring Boot try DropWizard. Similar support for REST interfaces but none of the stuff you don't need
I spent about 10 years in a niche: maintaining legacy PHP software. I have been down some very deep rabbitholes of PHP black magic. I have written 10+ medium-to-large applications from scratch in PHP, 4 of which are still running in production more than 8 years later.

I feel qualified to say the following:

- Java will not kill your startup. Bad coding MIGHT. But it also might not.

- PHP will not save your startup. Good coding MIGHT. But it also might not.

- You can write good/bad software in Java. I've seen both.

- You can write bad software in PHP. I've never seen good software in PHP (including my own). At this point, it's becoming hard to believe it is possible to write good software in PHP.

Mostly this is a problem with the awful design of the language. Adding better typing is helping, but at that point, why not just use something else?

Also, most arguments in favor of PHP mention its popularity. I suspect that if you removed WordPress, Drupal, etc. from the calculation, you'd see PHP plummet to the bottom. I don't know any young people who learn it anymore, and I haven't met a startup building their product in PHP in many years.

> I don't know any young people who learn it anymore, and I haven't met a startup building their product in PHP in many years.

That's a poor metric for whether you should use it though, as both groups tend towards over-focusing on new "cool" tech stacks. I bet Vue would come up as the top framework amongst these groups but it is certainly not yet battle-tested.

It's not the only metric, but it matters. It has a huge effect on who you can hire and who wants to work for you. Smart people are often attracted to learning new stacks.
It matters being on the other side for one of the reason the article cited -PHP programmers are more plentiful and cheaper than Java programmers.

I worked for a company that had a legacy product that was written in PHP and started hiring like crazy over the next year to bring an adjacent product to market in .Net. But by year two, it was obvious that the new product was something that the market didn’t want but they were getting more opportunities on the legacy PHP side.

Within 6 months after they abandoned the .Net product and started focusing on the PHP product, every single developer -14 in all left - starting with me. I called recruiters the same day that they announced they were focusing on PHP and left within a month.

The only reason it took 6 months was that some were close to thier three year vesting period and one or two others were closing on a house.

None of us were going to waste our time doing PHP. We knew there was no money in being a “PHP Developer”. Looking at LinkedIn, none of us mentioned that we ever touched PHP, we didn’t want recruiters wasting our time.

> We knew there was no money in being a “PHP Developer”.

The hate on PHP is real, but I think it's completely unjustified. I do a lot of work in PHP because is a great tool for anything web or Linux related. I can get code that works out the door quickly and it will happily run for years without issue.

I think the biggest issue with PHP is that it made software development much more accessible. I've worked on a few projects over the years that were started by some domain expert with no experience in programming. They are able to cobble a workable product together by reading a few chapters of a web development book.

The hate on PHP is real, but I think it's completely unjustified. I do a lot of work in PHP because is a great tool for anything web or Linux related. I can get code that works out the door quickly and it will happily run for years without issue.

The issue is not "hating" on the technical merits of PHP. The issue is going where the money is. PHP developers don't make nearly as much as C#/Java/NodeJS developers.

as an ex-PHP and current React/Node developer, I think that's because the tech market is pretty irrational. I could get a lot more done in PHP than I can in Node, and laravel blade templates are much harder to get wrong than your average react app that didn't need to be an SPA in the first place.
Python, Java, and C# are not new cool tech stacks yet they are still widely used in greenfield projects.

They've also evolved a lot (new Java frameworks are quite decent, asp.net has also gotten a lot better from the aspx days)

We have a PHP app written in the past n < 10 years. We’re actually looking for a lead dev. Shoot me an email if interested!
> I suspect that if you removed WordPress, Drupal, etc. from the calculation, you'd see PHP plummet to the bottom

You can't just say "... if I ignore the ~30% of the internet that WordPress powers".

But anyway, after that... Wikipedia, Laravel, Symphony, CakePHP.

At the bottom of that pile... I built a CakePHP front end for a startup that after 8 years and was sold for $50m. Didn't require massive scaling, but the code had to be released on Windows servers in internet disconnected sites. The PHP code didn't require a single fix to production in the last 6 of the 8 years.

> But anyway, after that... Wikipedia

Granted.

> Laravel, Symphony, CakePHP.

These are frameworks.

> I built a CakePHP front end for a startup that after 8 years and was sold for $50m.

That startup was much more than just that front end, wasn't it?

> That startup was much more than just that front end, wasn't it?

It was what 99% of all customers saw, and it was practically bug free for 6 years. What else do you want?

I built and maintained it primarily as a single developer. Yes there were other parts to the company, but both Slack and Facebook were started up purely on PHP - so there's no reason to suggest that you still can't build up $50m companies on purely PHP code.

Anyway the discussion from the article is whether it would have been better to write it in Java. I can't see what benefit Java would bring.

> so there's no reason to suggest that you still can't build up $50m companies on purely PHP code.

Yeah, that I agree with. The success of a company and the quality of the programming language(s) it uses are almost never linked.

>Anyway the discussion from the article is whether it would have been better to write it in Java. I can't see what benefit Java would bring.

Quite true, yes.

I can and will say that we can ignore WordPress when suggesting that PHP is good because it's popular.

The value of popularity for PHP comes from larger talent pools, better libraries, etc. WordPress doesn't contribute to those.

I started my company, ArkServers.io[1], in late 2016 and built mostly in PHP. I'm familiar with Python and Ruby, and have done projects in both, but still strongly prefer PHP.

I'm not sure what the standard for "good software" is, but I hope what I'm building is not too far from it! =)

[1] https://indiehackers.com/businesses/arkservers-io

I also prefer PHP over Python and Ruby, especially because it's a lot easier to find PHP devs.

I have written mostly-maintainable, very stable PHP apps. It took a huge number of tests, static analysis, comments, phpDocs, and trial/error of different libraries.

Since then, I've written back ends in C#, TypeScript, Go, and Rust. I have mixed feelings about all of those, but I'd never need as many tests. The languages allowed me to be stricter than PHP did/does. Type systems are also an amazing form of self-documentation.

Java developers like to solve the problem the “right way” while the PHP devs solve it “right now”. Latter works much better in early stage startups, but former is easier to maintain longer term.
I agree with what you said except for the generalization that Java devs always (or usually) do things the right way. I have seen some Java software that was a massive spaghetti-and-meatballs mess before it even reached beta.
Java developers design an abstract solution that will apply to all known instances of a particular problem, then provide an framework for outlining a custom solution via a well-defined XML schema.

PHP developers will solve the problem with an if statement and a value in the database.

I won’t dispute that PHP is an objectively terribly-designed language and has many fundamental and unfixable flaws throughout its implementations and throughout the language itself.

I’ll also agree that the popularity argument is completely facile (bots cloning old WP stacks to create SEO spam does not make you popular, that spam being responsive does not make you the biggest mobile app language, etc), the people making those arguments know it, and they continue to say these things anyway...

But, why do you think it’s impossible to write good software in PHP? How long has it been since you’ve written something big with it?

I would agree that it’s unlikely for a PHP project to result in good software, especially if it’s big and has had many contributors.

But in 2018, PHP has typing, it has packagist and composer, its community has agreed on a standards org and is rapidly adopting those standards. The ecosystem offers tons of solid open source libs and frameworks. PHP has all the language constructs you need to organize your code and scale it to multiple devs (namespaces, encapsulation, etc).

Facebook is still using PHP as it’s primary language (as hack, which is basically PHP7 with some differing notation).

Laravel is directly competing with Rails and Django and is easily in the same league.

So why can’t good (web-based) software be written in PHP in 2018?

> I would agree that it’s unlikely for a PHP project to result in good software, especially if it’s big and has had many contributors.

I disagree. I've contributed to several large open source PHP projects and never had any trouble figuring things out. It's surprising how quickly I can get comfortable with a massive, foreign PHP codebase. In fact, I think the structure of PHP makes designing certain systems, such as plugins, much more intuitive.

It also helps that the PHP community is often united on tooling. Unlike the Java community, whose tooling seems to oscillate between verbose & power to simple & rudimentary and back again.

I think, the author hasn't followed Java stack since Java 8. With things like variable handles, type inferencing and frameworks like Play, Spring boot. Its become fairly easy to kick off a new CRUD based web app.
God I hate clickbait. At least the author has the nerve to admit the inflamatory intent, so that's something I guess. That is all, carry on.
A badly coded PHP solution is a headache to maintain and support. A badly code Java solution is a brain tumor.