Skip to content
loading...

re: Which programming language/environment is more “powerful” than people realize? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: PHP. It usually gets a bad rap about being horribly ugly and difficult to work with, but that's just old PHP and Wordpress. Modern PHP frameworks...
 

The fact that you need to use PHP like Java in order to write maintainable code says it all. All these devs saying that it's not that bad when you follow all the best practices don't realize that all the time they're spending making non-shitty code in a shitty language is completely wasted. If you're smart enough to write good code, then do it in a language that doesn't get in your way.

PHP is a language that didn't expect developers to write actual applications with it. Even though it might be better than it was before, you're still working with the language in a way it wasn't initially designed for. This results in objectively cumbersome, verbose code. Working with a language thoughtfully designed to be used the way you're using it will double your team's productivity.

For every dev coming out of old PHP/wordpress hell, modern PHP frameworks are indeed much, much better. But they're frameworks, the language itself is still clunky and unproductive. Frameworks in other languages have been a thing for much longer. Combine this with the fact that these languages are actually designed to let you build fully fledged applications and you get a development experience that is better than anything you could ever have with PHP in the equation.

 

To do simple web things in Java you will need to use a lot of frameworks, implement a lot of interfaces, inheritance a lot of class and all those "I am so object oriented and corrected"'s stuff.

There are very big projects in PHP, so its no impossible to maintain large code bases.

PHP is the best worst programming language, you will find tons of web ready projects ready to use, you will loose time choosing a template of it. You will not find anything comparable in the Java's world.

"PHP is the best worst programming language"

I love it! I need to remember that line!

 

I think PHP is a pretty solid language. There are some frustrating inconsistencies, but PHP 7 has come a long way. We, as a community, are getting things we desperately need and want like stronger typing, better performance, and hopefully (soon) generics!

I get what you’re saying, but I also feel like dismissing PHP too readily is akin to throwing the baby out with the bath water.

I can’t disagree with your position that, if a developer is most productive in a language, then he or she would be able to work around its shortcomings in a way someone else might be unwilling.

For me, it’s very much a matter of time and productivity. I consider myself a polyglot developer (with varying levels of skills in different languages) but for me, it would be inefficient to gain an expertise in Python or Ruby and still deliver to my company what they need to make money and reduce risk. PHP is very much, for us, a business decision. There are better languages suited to what we need to do, but we simply couldn’t produce what we can today by switching.

 

To counter that, I would just say that writing a backend in any language is only as good as its frameworks. Without Rails, would anyone be writing Ruby backends? Or Java without JEE or Spring? Python without Django?

This is the fundamental reason why frameworks exist, because there are limitations or "clunkiness" to every language, and there needs to be some better way to use that language for a particular application. Who cares if the PHP language itself isn't quite as pleasant to write as Kotlin or Go, I'm still many times more productive developing backend applications with Laravel and Eloquent than I would be with anything else, and I believe many people would agree if they would give it a serious shot.

And furthermore, why is it impossible or wrong for a language to mature to be used in different ways than it was originally created for? HTML wasn't initially designed for interactive applications, and even CSS was bolted on after its inception. Javascript wasn't designed to work outside of the browser, so are Node developers as stupid as Laravel developers? No! Rather, it is these developers that are pushing the innovation of the language and its frameworks and making it better and better, not holding it back.

The fact that PHP started as an ugly templating language and has matured into a powerful dynamic OOP language isn't a sign that the language has lost vision or is unfocused. It actually shows how dedicated it is to being a great language for server-side development. And the fact that there are objectively great frameworks for PHP show that is has a power that many people don't realize.

A framework shouldn't fix your language. Frameworks exist to provide a set of abstractions as a common ground when building certain types of applications. That's why we need them. Their job is to orchestrate libraries and third-party code into a cohesive system, not redefine the experience of working with the language.

I agree that ultimately, productivity always comes down to personal preference. If you've tried other technologies and can demonstrate that PHP makes you more productive, then why not. I did give a serious shot to plain PHP, Symphony and Laravel, and I can tell you that even by slapping a framework on top of it, PHP still slows me down because of its infuriating inconsistencies. I have no problems with Laravel, I think that it's a great framework. The problem is PHP.

I have nothing against improving existing ecosystems. The improvements made to HTML and CSS over the years made things that weren't possible before possible. But they don't have any competitors. There is nothing to take their place so they need to get better. Node filled a gap in server-side development by proving itself as a very simple solution to applications with complex asynchronous needs.

PHP, on the other hand, is filling a gap that doesn't exist. It's in direct competition with python and ruby for instance. The industry didn't need PHP to "mature" into the clunky language that it is today.

I actually have mixed feelings about the existence of frameworks like Laravel in the PHP ecosystem. I mean, it's great because it keeps people from writing home-grown atrocities. But because Laravel makes PHP somehow usable, everyone thinks that, well, it's good enough so no need to look further. They stop seeking an acceptable solution. Using a framework in PHP should be the "AHA!" moment. It should make you realize that it's universally the way you're supposed to do it, and the fact that it's so different from what you're doing in plain PHP should make you understand that using a language geared towards this kind of usage should make you more productive.

But if PHP is your jam and you actually researched and studied the various alternatives, then the reasons that you have for using it are probably valid and enough for you to consider it to be the best suited tool. I happen to have come to a different conclusion.

code of conduct - report abuse