DEV Community

Discussion on: Will PHP save your startup?

Collapse
 
kyslik profile image
Martin Kiesel

Also, if you end up using any of the popular frameworks (Symfony, Laravel, Zend, etc) you're out of luck, as they all support 5.x still.

github.com/laravel/framework/blob/...
github.com/symfony/symfony/blob/4....

TO doesn't want for some reason type-hints in the Laravel.

I spent most of my professional carrier working on huge (>1.000.000 lines) legacy applications trying to clean up the mess my predecessors left behind themselves. Most of the pain came from over-engineered OOP monstrosities. Because of that, I truly appreciate the simplicity of Go and Rust and for me both PHP and Java would score really badly.

Have you spent same time with Go / Rust projects professionally (being paid for)? I think the over-engineered point is not fault of programmers but the company culture as a whole... feature this feature that, change request $this and you get the over-engineering, I think it's language agnostic.

Collapse
 
peteraba profile image
Peter Aba • Edited

Sorry I just realized that I didn't really give you an answer on the over-engineered point. Reality is, it's a complicated issue, at least in my opinion, but in short: No, I think company culture is the least of the problem. Not that it can't be, but it won't be a defining factor when I judge a language. You can write shitty code in any Turing-complete language, that's guaranteed.

Community culture may be a bigger problem with a whole range of issues from terrible and outdated examples out there, through terrible but successful legacy applications like Wordpress or Joomla to overengineered ones like Magento, a fair amount of elitism and feature-envy, etc.

Still, I think the biggest problem is the language itself as it just gives you (and promotes) things I personally consider harmful. Among them many things that many others swear by but I just don't have time or space to explain my reasons in detail here. Anyway, here's a quick list: inheritance, exceptions, implicit type conversions, falsy-truthy madness, typeless variables, ternary operators (arguable, but definitely often abused), inconsistent standard library, terrible track record retiring deprecated extensions, configurable error levels, errors vs exceptions, etc.

But if all of these were somehow fixed by the language or your coding standard, I'd still know that I broke my API within a second or so with Go while you'd have to wait for minutes for the CI server and hope that your test suite will catch it. That feedback loop is invaluable to me and I do believe it leads to better code. Even if it doesn't, at the very least there's less "self-defense" in the code base...

Finally, PHP is just full of flaws and compromises. I won't go as far to say that PHP is a fractal of bad design, but it's definitely not great.

Collapse
 
perttisoomann profile image
Pert Soomann

There should be a drinking game for referencing that blog post in any articles that are trying to prove PHP is less than X technology.

Thread Thread
 
peteraba profile image
Peter Aba

I wrote thousands of words and all you have a problem with is that I dared linking something that I even stated I don't completely agree with?

I'm sure you're aware that most people on dev.to never read that article, it just triggers you that it's still around, doesn't it?

Also the post didn't mention it, the only thing it mentioned is that classic OOP is in my opinion evil, which I will stand by, but I'm aware that's still not the popular opinion.

Thread Thread
 
perttisoomann profile image
Pert Soomann

Not so much as triggered, but finding it amusing that that blog posts works it's way into comments of any PHP pros v cons related article sooner or later. I assumed referencing a drinking game would make it seem clearly more light-hearted comment, my bad.

I actually was going to write a longer and more meaningful reply, but decided I should take my time with it and left it for when I get home.

I liked that you came to a conclusion that PHP on it's own is not necessarily going to kill any startup. It's pretty uncommon actually, because articles usually end with very strong statements like - technology X, only morons use it OR technology X, only morons would use anything else - so what it's worth, I found the overall tone pretty neutral, which is a good thing.

Collapse
 
marufalom profile image
Maruf Alom

You can write very good code with all of you 'design patterns' stuffs with PHP 7 :)

Stop referencing that blog from 2012.

Thread Thread
 
peteraba profile image
Peter Aba

If I referenced it in the blog post you'd be right. I'll stop referencing it in a comment about why PHP is not a great design, when it really becomes obsolete. That post contains many things which are unfair or very subjective and few which have been fixed, but the overall number of actual issues remaining is huge. You've learned to live with them and so have I, but it doesn't make the design any better.

Also stop telling me what to reference and what not to.

Collapse
 
peteraba profile image
Peter Aba • Edited

So they don't support PHP5 anymore. True, I should have checked the very latest version. Still, they don't enforce strict typing. Also if they did, it would make things slightly better, wouldn't be a game changer.

I have been paid to write Go. Rust no, and might never be. I will agree that it's totally possible to write good code using PHP, but I will argue that it's much more of an effort than with Go or Rust.

Collapse
 
vasilvestre profile image
Valentin Silvestre

Laravel last versions use strict types and you can use them in Symfony. It's already used in API platform.

Thread Thread
 
peteraba profile image
Peter Aba

Good to know. Seems like I'm getting a bit rusty. ;)