5 ms·
"why would I use PHP for anything more than toy projects?" Clearly PHP can, and is, being used for projects that go well beyond being toy projects. I doubt, fo
by smoody 18y ago
"why would I use PHP for anything more than toy projects?"
Clearly PHP can, and is, being used for projects that go well beyond being toy projects. I doubt, for example, that anyone would call Flickr, Facebook, etc. 'toy projects.'
"But at my current job, I’m in charge of adding features and debugging a massive functionally-written PHP codebase. It is horrifying."
Ah...there it is. His real complaint is about maintaining bad code and not about a bad programming language. I would argue (and even wager) that equally difficult-to-maintain code could be written in Java, Prolog, C++, Lisp, Forth, and Logo (well, maybe not Logo).
I've written commercial applications in perhaps a dozen programming languages (including Prolog) and I've had love affairs with them all and yet I'm using PHP for my current project. But then again, I'm writing some great code and I love maintaining it! :-)
- wooby 18y agoYou're right. By "current job," I meant the job I was supposed to be doing as I wrote that post. I was pissed off when I connected finger to key. And there are more than a few discrepancies in what I wrote. The "community" I bill as PHP's greatest asset also ironically produced the fellow whose code I'm maintaining. And, me. So it goes. The underlying reason for my frustration, and the reason I wrote what I did, go far beyond the scope of PHP.
- Retric 18y agoIt's OK to complain about language features that make it harder to maintain code. Most Programs I know would rather maintain old Pascal code than any other language, but they hate writing in it. PHP is the other end of the spectrum where it's easy to write and extend, but quickly hit's a wall where it's extremely difficult to maintain. You also have "full spectrum" languages like LISP where fixing minor bugs can be reasonably simple or mind bogglingly complex depending on who codded it an how it was maintained.
- natmaster 18y agoI interned at Facebook, and let me tell you, there weren't many people enthusiastic about being stuck in PHP. A lot of modern sites are in PHP, because that's what the best choice was when they started (as far as they could tell), and now are stuck with that decision.
- fauigerzigerk 18y agoOK but look at this jobs trend line from indeed: http://www.indeed.com/jobtrends?q=PHP&l= http://www.indeed.com/jobtrends?q=PHP&l= All those companies just got stuck and see no way out? I'm no devotee of PHP at all, but just getting stuck isn't something that works for long periods of time for so many new projects. These are websites, not core banking systems or OS kernels. I think the real reason for PHP's success is that PHP doesn't force people to become software engineers when all they want to do is print some database records on a web page. And it doesn't force employers to hire expensive software engineers just to thrust software engineering complexity down their throat when they really don't need any of it. Believe it or not, there is still a great number of websites that are not web apps and never become web apps. They just show you some pages of content with some dynamic parts on some of them. There's no reason for MVC, no reason for object orientation, no reason for separation between designers and developers, no reason for ORM, no worries about transactions, no interaction with messaging systems or other integration stuff, no need for unit testing or mock objects, no need for 101 deployment scenarios, no need for REST APIs, no need for maintainability because there simply isn't that much code to maintain. But that's what 90% of RoR, Django, JEE documentation is about. People complain about atrocious PHP code. That's because some websites "degenerate" into web apps over time. The majority of people who create them are not software engineers and have no interest in becoming software engineers. And yes some of those "degenerate" websites are getting stuck with PHP. But I think you would be mistaken to assume that all or even most of them go down this route. Most websites just remain websites. Some do a rewrite. Others add more interaction or features by installing one of those clunky CMSs. And the CMSs are written in PHP to let the creators of websites (not web apps) customise the system using little pieces of PHP, again without any need for software engineering practices. So if you need a taxi today, why would you hire an international logistics specialist? Is it because you might get stuck with Beijing taxi drivers shipping iron ore to your steel factory, or because you may never need iron ore deliveries? I think for most users of PHP it's the second. They never do complex web apps. And all of that has nothing to do with whether or not PHP is suitable for creating complex web apps using software engineering principles.
- vlad 18y agoGreat post, though it is hard to follow in some places. For one, the parent's statement that "a lot of modern sites are in PHP, because that's what the best choice was when they started (as far as they could tell), and now are stuck with that decision," is logically sound, while your response that "there are more jobs for PHP developers than ever" isn't mutually exclusive to the parent's idea, so I don't see where he is wrong; as well, I think his post was limited to putting in context the opportunities for coding what we consider to be modern apps of today, back in 2003 and 2004.
- ntoshev 18y agoAverage quality of Python and PHP code differs drastically, so there must be something about the language.