A look at modern PHP
481–490 of 610 posts
Re: A look at modern PHP
#482Earlier quoted context omitted.
Maybe, in my case since I am currently in the non-PHP phase of my alternating PHP/non-PHP job history. PHP has been less than 50% of what I've done (the rest being far more on-trend, if you will) though disproportionately represented among successful and profitable projects. The only-ever-PHP coders I have known tend to be fairly polarized between fear of the unknown and the "grass is greener" attitude. The ease of e…
With other languages there's some hope of a free lunch and it engages our tendency to optimism. Asking as someone who's mostly only written PHP (and some javascript, more recently): can you expand on this? What kind of "hope of a free lunch" is there with other languages?
The first is the promise of DSLs and meta programming, where you can tune the syntax of the language to more naturally express your problem domain. When this works it's beautiful, but sometimes it is a distraction and makes the code difficult to debug.
The second, which is conceptually very different but I find it can play out similarly, are rich type systems where you can hopefully build up your application as a series of well defined type relations and transformations. Again, when this works you get really robust, reliable, and easy to modify software but there are often cross cutting concerns or business practices that break the model.
Edit: when I talk about a free lunch or a silver bullet, I am often thinking about the writing of Fred Brooks.
Re: A look at modern PHP
#483Earlier quoted context omitted.
I mean the choice isn't literally arbitrary but it matters a lot less than the ecosystem and you can't really make a wrong choice as .NET, JS, PHP, Java, Ruby, Python, Go, $ReasonablyPopularLang are all plenty productive.
Sure, but there are legitimate criticisms around types, complexity, security, maintainability, scalability and performance where the language choice can matter. Certainly when the project gets large.
I think skill and knowledge of the coders is vastly more important then the language choice... you can write insecure, slow code in any language.
Re: A look at modern PHP
#484Earlier quoted context omitted.
Yes, that did sound condescending. I'm both a defender and detractor of JavaScript. I'm mostly a detractor of PHP, but could possibly defend it once in a while if I see misinformation. Peter Norvig at some point came to the realization that the deficiencies of Python relative to Lisp were not deal-breakers, and I don't think that stemmed from his limited experience.
Perhaps it was condescending, but it was, first of all, not intended to be malicious. I have had the luxury of having used a lot of programming languages for various projects. The first N years of my career, I used mostly C++ and Python. I didn't like Python much and was pretty convinced that C++ was the pinnacle of programming languages. Since then I've done (real, professional, for-profit) projects in PHP, Go, Java…
Your comment wasn't about people who like PHP. Your comment was about people who defend JS or PHP to the minimal extent of saying their deficiencies are not deal-breakers.
There are people with broad experience who are willing to accept deficiencies of a particular language if the context is right.
(I don't actually know what the right context would be for PHP; I'm more stating a general principle.)
Re: A look at modern PHP
#485Earlier quoted context omitted.
Going a bit off-topic, but I can't imagine doing "functional" programming in PHP or Java. C++ has const and top-level functions (PHP kind of does, but the autoloader...). It has (real) generics. It has move semantics, which is great for functional pipelines.
I do functional programming in C# and used to do it in Java at university. C# makes it marginally more pleasant but in general it’s pretty feasible, people will just look at you funny.
That's about as far as you can go with Java, I guess, but honestly, now that I type that out, I guess that does get you pretty far...
Re: A look at modern PHP
#486Earlier quoted context omitted.
Funny, I remember everyone hating on PHP when they moved to RoR, and now they hate that are and moving on. Its almost as if they just need things to hate so they can rewrite code. its very cyclical IMO. The elitism of learning a new language and then mocking those that haven't put in the same time and effort to row in the exact same direction, has always amused me. Ive never judged anyone for what tools they use to g…
This and the parent comments are assuming that all language criticism boils down to tribalism/elitism and not problems with the language itself, as if all PLs are the same, and the choice to use them is arbitrary.
Re: A look at modern PHP
#487The amount of misinformation, false claims and unsupported statements in this thread is mindblowing for the quality that I've been used to see on HN. Here are some facts: - Symfony was the backend framework with the most contributors in 2019 [1] (yes, out of any backend framework written in any language) - PHP has more active contributors than it ever had [2] - Laravel is one of the most used frameworks in the world…
Above all else, circa 2000 we could still rely on Moore's Law and therefore we could rely on a single CPU getting faster and faster every year. But once Moore's Law came to an end, it became increasingly important to be able to leverage concurrency, and PHP had no real story around concurrency (except the course-grained method of starting a new process).
PHP 4 was a very easy language to learn. It did not have many Object Oriented features, instead it encouraged a simple style of simple functions. Ironically, when it came to objects, the default behavior was "pass by value" so PHP 4 was, in a sense, an immutable language, long before that became a popular development style (tragically, it was not optimized to manage memory in a manner that would allow ambitious use of its immutable qualities).
Later, PHP developed an intense envy of languages that were seen as "enterprise ready languages". This lead to a lot of nonsense. First of all, PHP 4 was already good enough that it could be used in an enterprise, but this fact was ignored. Second of all, PHP 5 suddenly adopted a lot of Object Oriented features which added a lot of complexity to the language, but without offering the benefits that might have come from using a language like Java, such as compile time checks.
I used PHP from 1999 to 2011. I built my first and second startups using mostly PHP. However, in the year 2020, I can not imagine why anyone would use PHP. It no longer offers the simplicity that it offered in 2000. It no longer offers the straightforward procedural style that it allowed in 2000. It's "all in one" philosophy is no longer an advantage because now every language has a modern package manager that makes it easy to include whatever is needed. Nowadays, with Javascript, you just type "npm install" and you get every module that you need. And yet PHP still doesn't offer some of what a complex language like Java or C# might offer, especially regarding strict typing or compile time checks or run time efficiency, or a separate set of runtime flags for a compiled version. PHP has become a weird mutant, imitating the more complex languages but without offering their benefits.
And crucially, the other languages have not been stagnant. The community around Java eventually gave up on Struts and started developing light-weight frameworks that made development much easier. And there sprang up dozens of languages that run on the JVM and which offer a wealth of good ideas about how to do modern development. (I became a huge fan of Clojure.)
I seriously can not imagine why anyone would use PHP now. It no longer offers simplicity, but developers don't gain much from all the extra complexity that's been added.
[Added] A final point: this article makes it seem like Composer is something of a victory for PHP: now PHP has a modern package manager just like all the other languages. But this strikes me as a defeat rather than a victory. Circa 2000 I loved PHP because of its "all in one" philosophy. If that style of automatic inclusion is no longer possible for PHP, and therefore PHP needs to become just like all the other languages out there, how does that reflect well on PHP? One more unique strength that PHP once had is now gone.
Re: A look at modern PHP
#488Earlier quoted context omitted.
Where to begin? - No proper connection pooling with circuit breakers. - No proper multithreading (that works in web environment) or parallelism in general. - Almost everything blocks (even `new PDO('mysql:...')` can block for whatever the execution time limit is, if there is an issue with connection or MySQL server). - Most libraries are implemented in C instead of in PHP, whereas with other languages people try to a…
Something being written in C does not mean "understanding or contributing is close to impossible". That's as much of a boogeyman as I've ever seen.
I.e., for the criticism to not apply in this context, a solid PHP developer...has to also be a solid C developer. Given the context is "using PHP", the former is likely, the latter, not so likely. Exactly how likely I don't know (I don't use PHP, so don't really have an opinion anywaay), but most discussions I've seen around PHP don't also presume the adoption of C.
Re: A look at modern PHP
#489Ah, it's like old times again. Nowadays all the language-snob threads are directed towards JavaScript, but I remember the days when PHP was the language of choice for what HN considers the inferior programmer. Fun memories, all this thread is missing is a link to the fractal of bad design rant.
Re: A look at modern PHP
#490Earlier quoted context omitted.
I'm a PHP "hater", so take this for what it's worth. You are very close to implying that the language doesn't matter if you can hire developers and there are a lot of good packages in the ecosystem. Having worked on several PHP projects (Most being version 7.0+ and zero of them being older than 5.3), the languages is STILL full of gotchas, and it's a huge drag on productivity. I assert that this DOES matter. Even bas…
RE: string -> int, I'm not able to replicate this. https://repl.it/@JadoJodo/SelfreliantEdibleUsers edit: Not trying to discount your feelings overall, but just curious about that specific example.
https://repl.it/repls/CompetentBlondInstructions
Here I changed your string index to an int and it still says success!