Live data from Hacker News

I still love PHP and JavaScript

the.scapegoat.dev

231–240 of 402 posts

Re: I still love PHP and JavaScript

#231
post #4

PHP has so many hidden benefits: - it's stateless by design (much easier to scale) - it was "serverless" before Serverless - surprisingly performant - no "unknown unknowns". it's so tried-and-true, there's no surprises - deployment is so simple, just drop a file on a web server. No middleware needed. - No long compile times because there is no compiling needed. EDIT: why the downvotes? If you don't agree, just reply…

- it's stateless by design (much easier to scale)

That's sort of true, but the default state mechanism (session files) doesn't scale well, or even work across load balancers that don't maintain server affinity for each client. Scaling a PHP app isn't hard, but it can be non-trivial if you've written the code without considering scaling. Other serverside scripting languages (Python, Ruby with Rails) nudge you in the right direction in ways that PHP doesn't.

Re: I still love PHP and JavaScript

#232
post #202

I kinda like js but hate php with passion. Having said that php has one really very big thing going for it - people who use it are simply addicted to getting things done.

> Having said that php has one really very big thing going for it - people who use it are simply addicted to getting things done. does that mean every other language the people don't get anything done?

Its more like they dont care (or know) much about software development and their priority is getting stuff out of the door.

Re: I still love PHP and JavaScript

#233

What I like about PHP is how you don't have to use crap like Jinja2 or Twig to build complex logic while rendering HTML. Of course, some people will cry "spaghetti code" but sometimes you just want to get work done.

Yeah spaghetti code people then love react/jsx/vue… in vue single file components include html/js/css (structure/logic/presentation) in one file and everybody loves it. In PHP you structure it same way (even without css) and its WRONG.

Re: I still love PHP and JavaScript

#234
post #222

Earlier quoted context omitted.

I’ve always wondered why the more respectable dynamic languages, like Ruby and Python, don’t have a web framework with the PHP deployment model of “just upload this file to the server and refresh your browser to see changes.”

Python and Ruby have more startup overhead than Perl and PHP, so usually you don't want to pay that cost for every request. Edit: Not sure why this is controversial. Here is a "hello world" benchmark I just ran on my machine, in units of hello worlds per second: Perl – 1020 runs/second; Python – 78 runs/second; Ruby – 30 runs/second.

Can we have the "soft reload" model like how Django works in development mode?

Drop a file on a server, it notices filesystem change, reloads an app (or spawns a second copy of app, waits for it to initialize, kills original app and switches over to a new one)?

Re: I still love PHP and JavaScript

#235
TBH I don't like PHP but I admire how easyly deployable and ubiquous that it is.

It's so omnipresent that that Spolsky used a sort of translator from ASP to PHP to be able to run Fogbugz un Unix systems[0], which I think is a neat idea (at least for a source lang subset and with tons of problems to be solved, but a neat idea nonetheless).

[0] https://www.joelonsoftware.com/2005/03/30/the-road-to-fogbug...

Re: I still love PHP and JavaScript

#237
post #3

I love PHP, it fits that niche of having a fast startup like Perl, while having a big standard library like Python. However after using Go and Rust, I don't like the idea of the package manager being this separate thing (Composer). I think the package manager should be part of the PHP distribution itself, not some other thing that people have to find and install separately. I am fine if people want to implement other…

On the other hand JS now has many package managers yarn, pnpm and even competing runtimes deno, bun that include their package managers and have often incompatible code.

Composer is atleast undisputed, embraced and works well. Anything PHP is on there. Package formats are unified not like in JS.

Pythons PIP is also separate project.

Re: I still love PHP and JavaScript

#238
post #4

PHP has so many hidden benefits: - it's stateless by design (much easier to scale) - it was "serverless" before Serverless - surprisingly performant - no "unknown unknowns". it's so tried-and-true, there's no surprises - deployment is so simple, just drop a file on a web server. No middleware needed. - No long compile times because there is no compiling needed. EDIT: why the downvotes? If you don't agree, just reply…

> I feel like PHP documentation is very undervalued PHP is documentation done right because of the comments, essentially "Stack Overflow" for PHP before stackoverflow.com was a thing. I've found an example of documentation done wrong recently with Microsoft .NET 6.0. Apparently, Microsoft has decided that code samples are no longer important

What's happen to MS these days? I remember the documents during .NET 2.x days were very good, well-organized and useful.

Re: I still love PHP and JavaScript

#239
post #189

Earlier quoted context omitted.

You seem to think that you refuted my argument, but instead you reinforced it. By using Wicket you are making a choice to opt in to a template system that encourages best practices. This is the same reason people in the PHP ecosystem opt in to Twig/Blade/Mustache, or how people on Ruby opt out of ERB for Slim or Haml.

How many of them, and how well does the ecosystem support them in doing so? It's theoretically possible to write good code in any language, sure, but in practice the language (not just the formal syntax, but the tooling, ecosystem and community, the whole culture of the language) has a lot of influence on whether people write good or bad code in it.

Laravel is the top choice for PHP frameworks these days which auto opts you into Blade. And just from my my own personal experience (so not necessarily a great sampling) every non-legacy PHP codebase I've been involved with on various teams had adopted other template engines with Twig being most common.

Also, to be frank, it's a real shame that people look down their noses at PHP so much just because of the sheer amount there is that can be learned about the practical application of design patterns from spending some time in the Laravel code base.

Re: I still love PHP and JavaScript

#240

if you are getting shit done then that is all that matters - but it is hard to find a compelling reason to start with PHP these days unless 1. you are constrained to commodity godaddy-esque cpanel hosting or 2. you have an entire team of PHP devs.

I find Laravel a very compelling reason to start with PHP. If you start with Laravel today, you're most likely in a position to start with php 8.1 which has nearly none of the issues plaguing the earlier ones.

Rails of course is a great alternative. Depending on your requirements, experience and preference etc you might choose that over Laravel given that from what I heard they're similar in productivity and features.

Post reply on HN