Live data from Hacker News

PHP 8: Before and After

stitcher.io

321–330 of 346 posts

Re: PHP 8: Before and After

#321
post #298

Earlier quoted context omitted.

It was because every developer in the West was taught that inheritance based OOP was the one thing to rule them all. And that unfortunate school of thought created the Java mythos that spread to many languages, not only PHP, eg JavaScript (everyone trying to write inheritance based OOP in a prototype based language). Few years ago the mythos changed somewhat to every programming language should be functional. Thus it…

> It was because every developer in the West was taught that inheritance based OOP was the one thing to rule them all. > > And that unfortunate school of thought created the Java mythos that spread to many languages, not only PHP, eg JavaScript (everyone trying to write inheritance based OOP in a prototype based language) I don't think it's as simple as OOP being bad but rather the culture of complexity that everythi…

Correct, OOP in itself it’s not bad. I use it every day, but I mostly use composition rather than inheritance.

What I was trying to say was that the inheritance based OOP was sold as the ultimate problem solver.

We all remember programming classes with Hello World like examples of Cat inherits from Animal.

Problem is of course that in the real world is never that simple so the inheritance based model turned out many times to be a mess because it was applied to problems where it didn’t fit.

That doesn’t mean that inheritance based OOP has its place, it does, but that is usually in very specific domains.

Re: PHP 8: Before and After

#322
post #305

Earlier quoted context omitted.

Your analogy makes is sound as if the problem with PHP is that it's old or lacking features, whereas the point of the original analogy is that it's poorly designed. (Python is older than PHP, so it's not a question of being modern or not.)

By today's standards, old tools are poorly designed. At least, most of them. The one's that have stood the test of time aren't the bad ones. Those old tools still worked, just not as well as modern versions.

Many good and well-designed languages are older than PHP (Scheme is from 1975!), so that cannot be the cause of PHP's poor design.

Rasmus Lerdoff actually gave a great talk on why he created PHP and how it sort of accidentally turned into a programming language: https://www.youtube.com/watch?v=nmD1Q4FsXCc

Re: PHP 8: Before and After

#323
post #263

Please remember that PHP is more or less the only truly free (as freedom) community driven language suitable for both prototyping/pet projects and enterprise grade web software development. TypeScript and C# are Microsoft, Go is Google, Java is Oracle. Python is not suitable for complex multi-layered systems, Rust is too young and let's see where it will go without Mozilla. Ruby? IMO Ruby is in sunset phase, no new a…

Ruby is a fantastically good language with a slow bloated runtime. That killed Ruby. Python was less good and less bloated, but still bloated. I think we use Python now only because our computers are orders of magnitude more powerful than a decade ago when I was watching Python Zope slow to a crawl and die.

I think we use Python now because it is a language of choice in US schools, colleges and universities. Python is a new Basic.

Re: PHP 8: Before and After

#324
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…

the largest performance issue i've come across with the execution model is that connection pooling is...well, pretty crap. opcache handles most of the other interpreted woes rather well.

Are you talking about connection pooling to services like databases and caches? Most extensions implement it (pgsql and I think MySQL) but you need to configure it. I’ve also use a local nginx proxy to pool the connections.

Re: PHP 8: Before and After

#325

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#).

It's a different culture. They go around the problems differently. Also the way the write programs seems simpler and leaner (composer in mind)... probably not ultra safe but a good enough ratio I guess.

I’ve seen some self-balancing backed priority queues implementations, using some quirks of PHP, that are faster than the C implemented ones and faster than a “standard” implementation. Wall clock time, it’s still O(log n).

Re: PHP 8: Before and After

#326
post #195
post #188

Earlier quoted context omitted.

It differentiates variables from global constant things (constants, class names, function names, ...) for which the scoping is different. So you can have $strlen = strlen(...);

Off the top of my head, I struggle to come up with situations where you'd need an $ to distinguish class names or function names syntactically. Hell, in Lisp I can do (let ((length (length seq-1 ))) ... (length seq-2 ) ... ) just fine and it still works as expected, so no special characters necessary either. Plus, to have different scoping rules was considered a good idea? Weird scoping issues were why I gave up on R…

You can do:

$strlen = 'strlen';

echo $strlen('test');

I’ve also seen things like this:

$return = ...

You can’t use a keyword as a variable in most other languages.

Re: PHP 8: Before and After

#327
post #194

Earlier quoted context omitted.

Go isn't free? JS isn't free? Guile (which is probably as free as you can get) comes with a web framework too. Also what does "enterprise grade" mean? I'm not sure if you're aware but the forum we're talking on right now is written in PG's lisp dialect. I'm pretty sure arc is free.

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.

Re: PHP 8: Before and After

#328

Earlier quoted context omitted.

> Python is not suitable for complex multi-layered systems For example what?

It is too loose typed and it's implementation of interfaces is too relaxed to use complex software engineering patterns and methodologies like DDD and SOLID.

> it's implementation of interfaces is too relaxed

as someone only casually used to python im curious how so?

Re: PHP 8: Before and After

#329
post #285
post #283

Earlier quoted context omitted.

Not OP but I read this as something they miss because they no longer work with PHP.

Exactly :) Last time I touch PHP I think it was 5, I don’t know what happened in between so when I say “was” I mean it was for me.

I see, my mistake!

Re: PHP 8: Before and After

#330
post #214

Earlier quoted context omitted.

There is a discrepancy between what’s hip, and what’s actually used. On places like HN where everyone is in love with Ruby... errr... Go.... errrr I mean, Rust, you’d think that those languages are the what’s what. Then when you look at the job market, you get a very different picture of what actually gets used. In my country there hasn’t been a single job posting for all Rust in all of 2020. There’s been a single me…

That's quite strange. Rust is system level language. Most web stuff need no memory management and can happily live with GC or even with giant memory footprint and reboot once a day. Ruby is direct competition. One of two PHP major web frameworks borrowed everything they could from it. Even PHP is on Ruby bandwagon .... XD

> One of two PHP major web frameworks borrowed everything they could from it.

Weird flex.

So you're saying that an aged veteran in any sport who observes and learns from his younger peers should be looked down upon as being on their bandwagon? Their growth, improvement and continued success should be discounted?

> Even PHP is on _Rails'_ bandwagon .... XD

I fixed that for you.

Post reply on HN