Hacker News new | ask | show | jobs
by vrodic 3252 days ago
Do you have a public example that illustrates how PHP/Hack code in Facebook looks like?

My problem with PHP is that most of modern frameworks seem to take a lot from Java, and people have started to use type hinting whenever they can, so the code looks like (uglier) Java, but without advantages of performance (being made worse by having to setup everything on every request) or compile time type safety.

2 comments

> being made worse by having to setup everything on every request

That does have advantages though, I have yet to see a popular PHP application break down due to memory leaks, compared to almost all Java code I've seen eventually ending up in memory bloat...

1) php doesn't have to setup everything on every request - opcode caches, process pooling et al exist

2) the benefit of php over java is that php is going to run everywhere with no effort, and running that same java based website/service is going to start with some doc on installing tomcat or similar, which will devolve into chaos as you start working with ssl certs or shared servers

Bootstrapping a project with Spring Boot is 10x easier than dealing with some modern PHP framework's setup and nginx stuff.
Flat disagree. The php framework is going to run on every shared host in the world, and sprint boot isn't. I'm not saying PHP is better, I write java all day every day, but if I had to build a website for a random friend or family member, I'm writing it in PHP, because I know their hosting will run it.
I usually just create a VM from a DO template and that's it, no NGINX stuff (although it's very easy, NGINX has good documentation and sane and working default configuration).