3 ms·
I agree. I've seen some beautiful PHP over the years, but much of it... isn't so beautiful. The culprit as you say isn't so much the current state of the langua
by dperfect 13y ago
I agree. I've seen some beautiful PHP over the years, but much of it... isn't so beautiful. The culprit as you say isn't so much the current state of the language, but the legacy left as the language has evolved and the community that emerges as a result of the language's features/attractive qualities.
PHP is popular, readily available, and has a very low barrier to entry. It's the first language I picked up, primarily because it was the "gateway drug" of programming (for me). I had little intention to learn programming, but began making some basic HTML web pages in the mid 90's for fun. Other languages looked like greek and didn't interest me at all, but when I first saw a few snippets of PHP, I felt empowered because it felt more like an "HTML tag" that could perform logic rather than being a "full" intimidating language; I was naive, but that's how it felt. At the time, I didn't even completely understand the fact that PHP was executed on the server-side, while JavaScript (in my web page) was executed client-side.
Ironically, from what I understand, PHP was originally intended to be little more than a template language. OOP and other features were added later to allow PHP to function more like a "proper" programming language. Unfortunately, it still carries some oddities from the early days (procedural and OOP ways to do many things, the default use of PHP opening/closing tags even in scripts where HTML/markup may not be applicable, etc.).
I'm happy that PHP got me interested in programming, and I think it still captures the interest of otherwise non-programmers today. It still empowers people to do amazing things without forcing all of the complexities (or best practices) of other languages. I don't fault PHP for the situations described above (incompetent people getting in over their heads and turning a blind eye to best practices), but many of the features that make PHP accessible to these kinds of people (including myself years ago) don't exactly help encourage or enforce best practices. The same could be said for NodeJS and others as you say.
The current incarnations of PHP, NodeJS, and others certainly allow for more disciplined and well-designed code, but the culture/community behind a language is shaped by much more than just the current state-of-the-art.