Hacker News new | ask | show | jobs
by krapp 4688 days ago
You don't really understand why things are done a certain way until you've experienced first hand at how horrible it is to maintain a 6,500 line php file that's mixed with sql, php, html and a ton of inline css in a project that has about 500kb of mixed php/html/css files and like 30 different dynamic pages.

It's quite possible to write PHP applications which aren't that terrible, tightly coupled or unmaintainable. Perhaps you can blame PHP's low bar for entry for making those kind of bad practices possible, but it's not as if the language requires you to work that way.

Although I do see that kind of thing a lot in Wordpress, still.

1 comments

Yes I know but if you want to pickup "web development" as a beginner then chances are you're going to start with PHP unless you are getting trained by someone who happens to be using a different technology.

At least that's how it was back in 2006ish when I started. Its low barrier of entry is exactly why it's easy to make mistakes. You are given 5000 functions and no guidelines other than the ones you make yourself.

It's still bad, and there's a lot of bad legacy PHP code out there, but I don't believe it's as bad as it was. Although most new developers working with PHP will probably be hacking wordpress themes and plugins (which don't really have much in the way of best practices other than WP's sometimes infuriating API and mixins as a feature) but others will still end up using a framework like Symfony or Laravel, or Composer to manage dependencies and autoloading.

I don't know if it's even as common as it was to start in PHP without at least touching some kind of framework... although that's just an assumption on my part. At the very least there's a lot more good PHP code out there and better practices to be found, even if education seems like a dauntless task.