Hacker News new | ask | show | jobs
by pavel_lishin 653 days ago
Forget the framework, forget the AI assistant. What are PHP developers like these days?

Awhile back, we wrote an MVP, a proof of concept, using Wordpress. I dug around some of the plugins and themes we used, and my god, it's still garbage. Things being shipped with huge swaths of code just commented out, spaces & tabs intermixed for indentation, TODOs littering the codebase. Things that were just flat out broken.

I used to be a PHP developer, and the habits that I learned probably stunted my professional career by a good decade. And from what I've seen - granted, in a very limited exposure - tells me that most PHP developers still write garbage code. Weirdly, I've even seen examples at work where developers write perfectly cromulent Elixir and Javascript/Typescript, but somehow revert back to the fecal firehose when it comes to writing PHP code.

I don't care how good Symfony or Laravel is. I care about what happens when my employer hires someone who can't write good code, and in my experience, the odds of that increase hugely when we talk about PHP.

1 comments

> using Wordpress

Wordpress should be avoided like the plague if you care about code quality at all. It actively encourages bad code and this will never change.

PHP programmers being conditioned to write low quality code due to their experience with things like Wordpress or other legacy bespoke codebases that aren't built on top of good programming practices is a real problem, and using a modern framework alone won't solve that problem, but I think Symfony in particular deserves credit for generally trying to steer people in the right direction. If you're just starting out writing complex applications in PHP, by using Symfony with PHPStorm (and possibly other code quality tools like PHPStan and php-cs-fixer, though PHPStorm already has decent static analysis and formatting built-in), watching the SymfonyCasts tutorials and being open to learning new ideas, you will likely end up writing at least moderately decent code because almost all of your programming environment will be pushing you in that direction.

Of course, if you just hired a straight up incompetent developer, they will likely end up writing unmaintainable spaghetti no matter how much they're pushed in the right direction, and there's definitely a high risk of that when hiring PHP developers, but I feel like there's an equally high risk for any popular high level language nowadays. Especially Javascript, there seem to be tons of self-proclaimed "front-end developers" out there who literally only know how to copy-paste React code and don't actually know much Javascript or CSS at all.

> if you just hired a straight up incompetent developer, they will likely end up writing unmaintainable spaghetti no matter how much they're pushed in the right direction

I'm currently dealing with a laravel app. Said app has an 18,000 line "AdminController", and a 7k lines "WebController"

These contain all the logic. No, I'm not exaggerating. Model files are empty, save for 4 lines of model declarations. It's a whole CMS written in a SINGLE FILE. of course, such a dumpster fire can't exost without copious amounts of copy-paste, of which there indeed hundreds.

I'm talking multi-levels of nested if conditions, each with many branches, and said branches are very well over 10-20 lines of code that only differ by a single word.

And I won't even get to the disgusting mess that is the view templates... Let's just say they follow the same principles as above, except the original developer was unfortunately constrained by having to create a separate view file for each controller method.