10 ms·
> 6. Maybe PHP Doesn’t Suck Being a PHP programmer, I can concur: https://stitcher.io/blog/php-in-2020 https://stitcher.io/blog/php-in-2020
by brendt_gd 6y ago
> 6. Maybe PHP Doesn’t Suck
Being a PHP programmer, I can concur: https://stitcher.io/blog/php-in-2020 https://stitcher.io/blog/php-in-2020
- pavel_lishin 6y ago> While many of the arguments against PHP still stand today, there's also a bright side: you can write clean and maintainable, fast and reliable applications in PHP. You can, but in my experience, most people don't. Especially in Wordpress land. I've paid for plugins with egregious problems that "work okay" because error reporting is silenced. > if you want to, you can write modern and clean PHP code, and leave behind much of the mess it was 10 years ago. But most people haven't, and I'm not really interested in spending my career and hobby time playing Russian Roulette with coworkers and collaborators.
- kozhevnikov 6y agoCan it be helped with a good linter? JavaScript had similar problems as there were more bad things about it than good, but with ESLint and a good config (Airbnb's or other) community evolved and most of the new stuff adheres to best practices by default.
- BiteCode_dev 6y agoBut the stack in JS is a terrible burden in itself, and people only accept it because we have no realistic alternative to JS on the most popular plateform in the world: the web browser. PHP doesn't have this accidental monopoly: you can use a language that doesn't require discipline and tooling to make something decent. Bottom line, PHP is better than it used to be. But the technical debt remains, and it's easy to avoid if you can, so we do. I started with PHP, but I have no reason to go back to it. It has no benefit and is worth it only if you have already a massive PHP code base, or a pool of PHP devs you need to employ.
- pavel_lishin 6y agoIf you know a magical language that can result in excellent code without discipline, I'm all ears.
- bitexploder 6y agoI think the spirit of their argument is that there are plenty of languages with more benefits from an engineering standpoint and fewer downsides. Static typing, cleanser language construction, etc.
- jerf 6y agoI don't know of a magical language that can result in excellent code without discipline. But languages do vary significantly in how hard it is to take non-excellent code written without discipline and safely make it better code. The dynamic scripting languages are on the bottom of that list; all the freedom they enable also simultaneously make that harder. This is probably the best way to understand the increasing push towards static types lately. It isn't so much necessarily the experience of writing the code the first time, where static types may at least sometimes indeed be a bit harder to work with. It's that it's a relatively easy to work with code that takes a list of OrderIDs and CustomerIDs and returns a map of CustomerID -> Order, and calls a function that takes an OrderID and yields an Order, a method that takes an Order and yields a Customer structure, and a method that takes a Customer and yields a CustomerID, and finally constructs exactly the promised structure. You can change it and feel pretty good about what's going on and what's going to happen both to the code it calls and the code that call it. On the other hand, working with code that takes a something and a something and returns a something, calling a function that takes as something and yields a something, another function that yields a something and a something, and a method on one of those somethings that takes a something and yields and something, and then returns something, is harder to work with, before we even talk about the fact that these somethings may have no literal source code existence because there were dynamically assembled, and after the somethings were dynamically assembled, other somethings may have come along and turned those somethings into something else. Obviously, the first case still isn't heavenly and the second case isn't as bad as I make it sound in this brief summary, but there's still a real difference.
- marcosdumay 6y agoThere's no linter for hiring candidates. When you announce a PHP position, you are acknowledging that you'll get someone that doesn't care about maintainability, security, and whatever. Candidates will react accordingly. And yes, Javascript has similar problems, but much less severe.
- umanwizard 6y agoFacebook has almost certainly the world's largest codebase in any PHP-family language (Hack, which is essentially PHP + gradual typing + a better standard library, but still very much PHP-flavored). The code is fine. Part of the reason is the improvements of Hack over PHP, part of the reason is very aggressive linting (to, e.g., enforce the use of types), and part of it is probably that Facebook doesn't hire for "PHP positions", but for generalist software engineers.
- eeZah7Ux 6y agoFacebook indeed does not have the same hiring bar as "$company php (sweat)shop". However, all the other companies align themselves to the level of the average candidate they can hire. The quality of the library ecosystem in both js and php is a good measure of that level - sadly.
- boarnoah 6y agoAnecdotal, but I was involved in technical interviews for a full stack developer position within a team last year. Our stack at the time was transitioning to .NET Core, but the HR posting was some generic one (I believe for a "full-stack dev" with PHP experience). Got a bizarre range of candidates who had got past the inital filtering, all except one whose PHP amounted to wordpress only experience (some who were not able to clearly differentiate between serverside and clientside state or logic). Don't want to tar folks with the same brush, but that experience led me to believe the folks who got filtered through for possessing PHP experience, in this case, were extremely bottom of the barrel.
- pavel_lishin 6y ago
- pavel_lishin 6y ago> Can it be helped with a good linter? No. But it can be helped with a tech lead/team lead who can kindly but ruthlessly enforce good coding practices. I was lucky to have one of those when I was learning Java, and a lot of the habits they've taught me ended up being pretty universal, and I owe them a great deal of gratitude.
- winrid 6y agoI would not classify Airbnb's linting rules as good in ANY metric for server side code. It has rules designed for frontend, and then people go and use those settings for NodeJS...
- pavel_lishin 6y agoCan you expand on this? Why would linting rules, which are almost always strictly about formatting, impact server vs. frontend performance?
- winrid 6y agoOne example is they disallow for of loops because they are hard to transpile to es5, but that makes no sense for NodeJS.
- dzonga 6y agopeople can laugh at php, all they want. I personally, don't use php, but admire the community. because they, python n ruby dev's are good at shipping software frequently. look at laravel ecosystem. people getting shit done. n contributing i.e tailwind css | ui | alpine.js
- Juliate 6y ago> You can, but in my experience, most people don't. The same argument can be said of all languages. It's true with PHP because the language is popular. It's true with Java, because the language is pop^Wthe holy grail of entreprise software language. Having seen both worlds in small and large corporate settings (and others, in Ruby, Python, C, Perl), I somehow prefer PHP, because at least, it does not pretend to be "the right thing" for enterprise software.
- HideousKojima 6y ago>The same argument can be said of all languages At least languages like Java and C# require static typing (though I'm sure there's some lazy sociopath out there writing C# with every single variable as a dynamic), PHP doesn't even have that minimum bar
- CDSlice 6y agoNeither do Python, JS, or Ruby. Personally I’d say a good dynamic language like Python is better than a rough dynamic language, but a good static language is better than a good dynamic language.
- LadyCailin 6y agoAnd that is a solid argument against Python, JS, and Ruby.
- Juliate 6y agoRight, but a type system is as good as it is used. And Java having a good one is no protection against the development cultures of large (consulting or non-tech) companies where the main metric is not the performance of the software neither the frugality of the hardware it runs on.
- cfv 6y agoYeah I'm pretty sure the language that has birthed conventions like HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor and RefreshAuthorizationPolicyProtocolServerSideTranslatorPB are rife with great practices that are in no way obscured by layers upon layers upon layers of half-assed abstraction. The one with System.ServiceModel.Install.Configuration.ServiceModelConfigurationSectionGroupCollection in it surely musts be awesome too; I've heard great things about it. The footguns in a given language being more ornate and towering than in another doesn't make that language better, but the ability to produce resilient, maintainable solutions for a given problem space in it.
- jdxcode 6y agoas someone that knows vanishingly little about PHP, is there anything in PHP I can't do in say, TypeScript (or at least not as expressively?)
- hibbelig 6y agoIt’s less about the language and its expressiveness. PHP has a shared nothing concurrency model. For the typical Web 1.0 requires response processing it’s quite convenient.
- stickfigure 6y agoThat section really should have been retitled: 6. Maybe Monoliths Don't Suck There really wasn't anything PHP-specific there. My monolithic Java backend restarts much faster than webpack can rebuild my frontend. Complex microservice systems (like Netflix's) make for complicated developer setups in any language.
- winrid 6y agoAre you using Spring? I've seen medium-large Spring Java apps take 10-15s to start. Not to build - to start. They're usually very fast then though.