5 ms·
PHP was intended to be a templating engine and nothing more. It's the community that pushed it in that direction even though that wasn't the creator's intention
by axegon_ 7y ago
PHP was intended to be a templating engine and nothing more. It's the community that pushed it in that direction even though that wasn't the creator's intention. And though that has lead to some bad decisions, let me be the one to say it: though it is by no means a good language, it's far not the worst. Surely, dive into most other dynamic languages and you will quickly want to stay as far away from php as possible. And in the modern day and age if I were to start any project from scratch, regardless of what it was, I can't think of a single reason to use PHP over most other available options. As a matter of fact java and javascript are the only two languages I'd avoid more than PHP. Java for all the annoying boilerplate code you have to deal with as well as the incredibly strict way of how you need to structure your application and javascript because it's horrible in every way - syntax, type system, ecosystem, npm is probably the worst thing to ever come out of mankind. I think this might be the result of a small number of js developers who were above average and wanted to prove the "haters" that javascript can do more than juggling dom elements. I can probably write an entire book of why both java and javascript are horrible languages but that's not the point here. PHP has evolved and while I can't really find a single vallid reason for using it in 2020, other than legacy systems or maintaining something that isn't worth the effort doing from scratch, it isn't the worst language out there. Certainly not as horrible as people portray it to be.
- rhacker 7y agoI guess those are personal preferences. I would rather use typescript and Java moreso than PHP, Python, Ruby, C++, C#, etc... Not exactly sure what exactly is specifically wrong with npm, have you tried yarn?
- axegon_ 7y agoBoth tpescript and yarn live under the npm ecosystem which, to put it mildly, is a meal that was un healthy and tasted horrible and in attempt to make it better, thousands of cooks tried fixing by eating it, puking it out, cooking it again and repeating that process thousands of times. As I said, I can write a book about the bad things which from all the languages I've used, are only applicable to js & co.
- rhacker 7y agoSo no real example or specific reason it is worse than maven, cpan, or any other.
- axegon_ 7y agoWell cpan hardly matters in 2020. I haven't even heard of perl in a good 6 years or so. Marven, though largely a java(also a horrible language) thing, targets languages which at least aren't used and abused by people who believe that "6" + 1 = "61" and "6" - 1 = 5 are acceptable behaviors. What's more is the fact that compiling the entire linux kernel takes less time and resources then it takes node to figure out how to "compile" x = 1 + 1 into the gibberish it makes. Also the preinstall, postinstall, preuninstall and postuninstall, all of which are horrible concepts and I have no idea what kind of an idiot thought that this isn't literally inviting the security hell into your bed while you are strapped down naked. I can go on for days, those are just off the top of my head while I'm falling asleep.
- aikah 7y agoIt became popular because accessible (for both 'developers' and hosting company). It's a case of "worst is better". The alternative around 2000 was either Perl CGI or ASP classic or Java. Java was too complex for most beginners because it forced OOP, and there was not a lot of resources on OOP back then, unless one already knew Delphi or C++. The irony is that professional PHP development can now be deemed more complex than Java, as the language is trying to fix itself with pragmas and what not for type guards and co... Strangely, there is no real alternative to the whole "drop a script on a server", aside from using basic CGI or FCGI which many classic hosting companies do not provide. > I can't think of a single reason to use PHP over most other available options Many online news or organization web sites are still running Wordpress, Drupal or a heavily modified version of it. But like everything they tend to disappear as it becomes costly to maintain, compared to SAAS solutions which are rapidly replacing all that code.
- Keverw 7y agoNPM kinda annoys me too. Like you have to pay to do private packages or you could run your own server, etc... Been thinking on that lately. However looks like you could point to a tarball on a http server or on your file system, so that might be a solution for shared libs too. Really like the idea of mono repos but hate the idea you have to publish everything to say if you wanted to build a container image. unless you built and linked everything then your container would include code for your other apps too... I been wanting to play with a tool called NX though, hoping that might be more what I want, and then for the few packages I want to reuse outside of the mono repo or say you had two mono repos for two separate products I like the idea of just downloading the tarballs to a file location and referencing that way. Also could give it a GIT HASH and using a GIT repo too as another alternative. But yeah, dealing with private packages has been my big thing that annoys me but might have a better solution. Not sure how other devs or teams handle this sort of thing. The other big thing people hate about NPM I think is nested packages, etc... Sometimes you might not even know what your downloading since some packages can pull in a bunch, but I think other package managers have this same problem maybe like say Ruby's but haven't looked into it much but remember trying to run some Ruby app years ago in a container but forget what for but I think it mentioned downloading the same thing multiple times. I don't think this problem annoys me as much though but it's something to be aware of and I know some might be annoyed more by it.
- mekster 7y ago> Surely, dive into most other dynamic languages and you will quickly want to stay as far away from php as possible. I always think these kind of comments are nothing but pedantic. PHP is a good enough tool to get the job done and it's stable with good amount of ecosystem and is a good choice if the app is consumed broadly as many hosting providers would at least have PHP installed. If you can't get something done with PHP, I doubt you can using other languages anyway. Then, what else would you use? Python, Ruby or node.js? Which one provides instant reload of code upon saving the file? These aren't far better than PHP to stay far away from PHP. PHP isn't my primary language any more but I'd still use it if I need max pool of future maintainers. The only real annoyance is PHP requires semi colons which does get in the way of coding as you need to type it along with closing quote and bracket when it's already there after each autocomplete when other languages don't need to.
- axegon_ 7y agoAs I said already, I hate js and node with a passion. Having gone through many operating systems, technologies and languages over the last 21 years, I can say that the two languages I'd ban immediately if I become world emperor would be java and js. As for ruby, I never really worked out what's the deal with it. Personally at this point if I were to start a new project targeting the web I'd opt for either go or python, depending on what needs to be made. Side note, I never really understood why people hate semicolons.