Live data from Hacker News

PHP 8: Before and After

stitcher.io

331–340 of 346 posts

Re: PHP 8: Before and After

#331

Earlier quoted context omitted.

I totally agree. What I'd actually welcome these days is a web "glue language" which adheres to what PHP wanted to be in the beginning (easy HTML output, one file per page, easy database querying, easy CGI interfacing), but without any OOP bolted on (C-style procedural would be fine), without any of the horrible security decisions, and with strong typing. It would make a nice counterpoint to all OOP-style web dev lan…

Isn't this what PHP still is? Can't you just drop index.php into a directory?

It is, but also note my other points:

1 - security-safe and type-safe from the beginning 2 - none of the additional programming paradigms. PHP wants to be everything in one language. I know you can still use PHP "basics" like that, but it's not going to be easy to find tutorials etc. showing that

The main point I wanted to make was not about the index.php file. In other words, I'd like a PHP3, but a clean, safe, very well-designed one.

Re: PHP 8: Before and After

#332

Earlier quoted context omitted.

Isn't this what PHP still is? Can't you just drop index.php into a directory?

Was going to ask the same thing. There's not much in PHP 5/7/8 which precludes just doing some raw db queries and including some templates. The biggest 'drawback' might be that there's not one name-branch 'framework' which takes this approach (indeed, it's the opposite of 'framework' thinking). But if there was some project that documented/demonstrated 'best practices' for 'non-framework' projects, it might help redu…

> The biggest 'drawback' might be that there's not one name-branch 'framework' which takes this approach

Exactly! That comes close to the point I wanted to make

Re: PHP 8: Before and After

#333

Earlier quoted context omitted.

> It's becoming kind of an Enterprise language It tried for decades to be one with Doctrine, Symonfy and co, trying to copy the worst of Java EE with every single possible design pattern implemented in these frameworks, XML configuration files and co... The problem is no generics, no private packages makes PHP OO a horrible mess compared to Java (or C#).

I agree with you. Symfony and composer in general has just turned our code base into some kind of fugly java like monstrosity. When I used composer the first time I really enjoyed it, that project also used Silex a minimalistic symfony2, which I also really liked. But what I found out is that in general it is really terrible to be dependent on others, as Silex was dropped by Potencier and my project is left in limbo,…

Silex was ok but to be fair you can get almost the same thing with the Symfony micro-kernel trait.

Re: PHP 8: Before and After

#334
post #281

Earlier quoted context omitted.

No, I'm talking about the kind of thing that provides a `Context`-like object that allows the application developer to share memory between requests.

you mean $_SESSION? that was there since at least php4

And even that is limited to sharing data for a single user between requests. It's hard to accidentally share data between users.

Re: PHP 8: Before and After

#335

Earlier quoted context omitted.

I know you're trolling, but FYI the `static` before function has nothing to do with the `static` return type. Like other programming languages the term `static` is used to denote two things.

And other programming languages get away wihout overloading the term. It's not an excuse for slacking on language design.

"static" itself is originally an overloaded term, and still remains such to this day in C++.

Re: PHP 8: Before and After

#336
post #327

Earlier quoted context omitted.

Go will go where Google wants. If you are not Google, you have zero chance introducing substantial changes into it. JS is not a programming language, it's some nonsense.

If we count C as a programming language with all it's nonsense we have to count JS. Your point with Go makes sense (although IMO it's better than most of google's "open source" projects.) You didn't have an answer for Guile though. I'd pay money to be able to build web apps in scheme instead of PHP.

What nonsense in C makes it comparable to JS? JS today is more like assembly language, other high-level languages are translated into JS.

Re: PHP 8: Before and After

#337
post #327

Earlier quoted context omitted.

Go will go where Google wants. If you are not Google, you have zero chance introducing substantial changes into it. JS is not a programming language, it's some nonsense.

If we count C as a programming language with all it's nonsense we have to count JS. Your point with Go makes sense (although IMO it's better than most of google's "open source" projects.) You didn't have an answer for Guile though. I'd pay money to be able to build web apps in scheme instead of PHP.

I know nothing about Gulie. That makes me think it is some niche language with no ecosystem, no frameworks and limited number of packages.

Go is good, but my point was not about goodness, but about language being free and community-driven.

Re: PHP 8: Before and After

#338
post #222

I don't really understand why in 2020 there's still this kind of blind hatred against this language. It often comes from horrible bad memories from previous versions or old frameworks. Objectively, compared to other languages i've been working with it is more than OK. Despite it's lack of "style" it is easy to understand, host, tests, diagnose and it is powerfull for web applications. I've been working on a SaaS API…

> I don't really understand why in 2020 there's still this kind of blind hatred against this language. I don't either, but what I also don't understand is why in 2020 anyone would use PHP over many available vastly superior alternatives. Other than keeping old stuff running, why do people keep beating this dead horse? I just don't get it.

It depends on your goal. I personally think PHP still wins for a solo developers in speed of feature creation. Think of the ratio of business value per development cost. Someone should find a way to objectively measure this.

Then there's this, choose boring technology: https://news.ycombinator.com/item?id=23444594

Re: PHP 8: Before and After

#339
post #61

Earlier quoted context omitted.

Lately I see myself abusing (???) types more often than ever. Before, I'd feel comfortable returning an array of structured data from a function. Now, I'm creating Value Objects to ensure my data is both valid and correctly used elsewhere. Kinda feels nice to get intellisense working too and knowing that the things that I'm trying to do with that VO are valid

But your IDE could understand your code for years with: /* @return MyObject */ Returning an array with unknown items has always been bad practice imho.

Your IDE but not the PHP Interpreter, that's the advantage of making a typed return.

Re: PHP 8: Before and After

#340
post #230

One of the underappreciated pros of php for web development is its execution model, it's fault tolerant by default and shares little memory across requests. This kind of makes sloppy programming far more tolerable in php than in other platforms. In effect this has an impact on performance but it also helps in ensuring that a bad request can't blow out the whole application from serving other requests like is common i…

This model is also exceptionally successful in Java Servlet, C# Razor Page, and elixir. And perl CGI. It's possibly more common than not!

Servlet shares instance between request (or you can configure DI container, not so simple), Razor is just a template.
Post reply on HN