News for hackers. Stuff that matters.
Re:So many bad takes. Learn from the Prime Video microservic... by iLoveOncall on Sunday May 07, 2023 @04:49PM (#35855482)
> there is a good reason people shy away from PHP

Please share it. And don't rely on articles that are more than a decade and 3 or 4 versions of PHP old.

Re:So many bad takes. Learn from the Prime Video microservic... by 5Qn8mNbc2FNCiVV on Sunday May 07, 2023 @05:14PM (#35855656)
Afaik you cannot discern null and undefined. So, not there and "null"? Either that or I'm going to have to have a good talk with my colleague
Re:So many bad takes. Learn from the Prime Video microservic... by iLoveOncall on Sunday May 07, 2023 @05:37PM (#35855854)
Go have your talk [1]. But that's a pretty weak argument given that:

1. Other languages also do not have this distinction (Python for example AFAIK),

2. It's relatively useless. I get the value of it in JavaScript which has a lot of asynchronous code and frontend where the behavior may indeed be very different between null and undefined, but in a server-side application I don't think the nuance is necessary at runtime, and potential programming mistakes involving that can be caught by a linter.

[1] https://stackoverflow.com/questions/6905491/how-to-tell-whet...

Re:So many bad takes. Learn from the Prime Video microservic... by ThalesX on Sunday May 07, 2023 @05:57PM (#35856001)
> Afaik you cannot discern null and undefined.

This is a discussion for us tech folks. When it comes to business. Customers don't give a rat's ass about this as long as the product provides them with value.

If you're flooded with customers and the tech stack is a pain in the ass, perhaps it would be a good time to start considering this, but until you have this problem, the technical aspects are just wasting investor money and / or engineering time.

Re:So many bad takes. Learn from the Prime Video microservic... by resonious on Monday May 08, 2023 @02:18AM (#35858671)
When I (an average developer) accidentally check for null but not undefined in the code and it causes a bug, the customer might care a lot.
Re:So many bad takes. Learn from the Prime Video microservic... by ThalesX on Monday May 08, 2023 @03:11AM (#35858931)
There is always a balance to strike between development and delivery. When creating a system with high potential failure costs, it's important to select a technology stack that minimizes common errors for developers.

For most companies, issues like `undefined | null` bugs can be resolved with just a few code adjustments, resulting in only minor inconvenience for customers. As long as problems are addressed and the product provides value, customers will continue to support it.

There are CEOs and CTOs that feel differently. I wish them luck.

Re:So many bad takes. Learn from the Prime Video microservic... by skinkestek on Monday May 08, 2023 @12:31AM (#35858108)
https://stackoverflow.com/questions/6905491/how-to-tell-whet...

At the language level PHP has about the same problems as JS.

Thankfully it looks uglier so people get an early warning before using it for everything.

Re:So many bad takes. Learn from the Prime Video microservic... by lelanthran on Tuesday May 09, 2023 @01:15AM (#35870426)
> Afaik you cannot discern null and undefined. So, not there and "null"?

So?

Don't similar footguns appear in Python and JS? Why single out PHP for footguns when the other languages are no better?

While I'm not a PHP programmer, I have used most programming languages, and PHP doesn't seem any worse than the competitors.

Re:So many bad takes. Learn from the Prime Video microservic... by proxyon on Sunday May 07, 2023 @07:50PM (#35856708)
How about the fact that most of us are experienced and can attest that PHP is the worst language we've ever used in our careers?
Re:So many bad takes. Learn from the Prime Video microservic... by aarondf on Sunday May 07, 2023 @08:28PM (#35856871)
Genuine question, when was the last time you wrote PHP?
Re:So many bad takes. Learn from the Prime Video microservic... by proxyon on Sunday May 07, 2023 @08:59PM (#35857022)
5 years ago and I wish I hadn't.
Re:So many bad takes. Learn from the Prime Video microservic... by chalcolithic on Monday May 08, 2023 @04:05AM (#35859179)
It was fine in the late 90s. Very adequate for the hosting landscape. I have not touched it since that time
Re:So many bad takes. Learn from the Prime Video microservic... by jcparkyn on Monday May 08, 2023 @12:11AM (#35857997)
Spoken like someone who's never used Matlab :)
Re:So many bad takes. Learn from the Prime Video microservic... by itake on Monday May 08, 2023 @01:51AM (#35858542)
> indexes start at 1

- no one

-- Matlab

Re:So many bad takes. Learn from the Prime Video microservic... by MiyamotoAkira on Monday May 08, 2023 @02:13AM (#35858642)
Pascal had indexes starting at 1 too.

Starting indexes at 0 makes sense when you want to enable the developer to manipulate memory (for example, C)

Indexes starting at 1 matches with a more natural ordinal sequencing.

Re:So many bad takes. Learn from the Prime Video microservic... by haspok on Monday May 08, 2023 @04:26AM (#35859308)
> indexes starting at...

"I don't understand the word 'index'".

- a functional programmer

Re:So many bad takes. Learn from the Prime Video microservic... by selcuka on Monday May 08, 2023 @04:33AM (#35859356)
The most evil was Visual Basic where you could configure the default starting index (OPTION BASE 1), leading to weird bugs when multiple people worked on the same codebase.
Re:So many bad takes. Learn from the Prime Video microservic... by itake on Monday May 08, 2023 @09:21AM (#35861265)
I don’t understand. Either your saying adding or removing elements to an array doesn’t manipulate memory, or you’re saying adding or removing elements in an array does manipulate memory, but the developer doesn’t care due to the GC.

If it’s the second option, why has (almost) every other language chosen with a GC to start arrays with 0?

Re:So many bad takes. Learn from the Prime Video microservic... by pdntspa on Monday May 08, 2023 @02:02AM (#35858597)
I can think of far worse fates

Some people write whole-ass applications in bash, the psychopaths

Re:So many bad takes. Learn from the Prime Video microservic... by proxyon on Monday May 08, 2023 @02:08AM (#35858614)
Ok that's even worse
Re:So many bad takes. Learn from the Prime Video microservic... by arpa on Monday May 08, 2023 @05:28AM (#35859701)
That is actually better, but you have to be a pervert. Source: wrote some fully featured applications using own bash framework.
Re:So many bad takes. Learn from the Prime Video microservic... by lelanthran on Tuesday May 09, 2023 @01:16AM (#35870435)
> Some people write whole-ass applications in bash, the psychopaths

*giggles nervously, then changes the subject.

Re:So many bad takes. Learn from the Prime Video microservic... by Hamuko on Monday May 08, 2023 @02:57AM (#35858867)
Yeah, I feel like PHP is a massive hiring risk. I personally wouldn't want to touch any PHP code unless I'm paid a massive premium for it.

(I mostly write Python professionally, and use Python, Swift and Rust in personal projects in case anyone is wondering.)

Re:So many bad takes. Learn from the Prime Video microservic... by coolg54321 on Monday May 08, 2023 @03:08AM (#35858917)
I don't think so, i've used PHP at work for more than 10 years till 7.4 point mostly Symfony, it has it's own quirks but i still feel PHP really pragmatic. I don't have any strong feelings against it.

Nowadays im on django/python because im in a python shop and I like python too.

Re:So many bad takes. Learn from the Prime Video microservic... by Cthulhu_ on Monday May 08, 2023 @03:50AM (#35859117)
I disagree; it's not the language that's bad, it's the community. Too much tech debt that was never removed, too many people that profess to be experts on the internet and give bad examples, and too many people full of themselves building and rebuilding their own frameworks. That was the issue 10, 15 years ago anyway, things have improved but it means people have to pick established frameworks like Laravel.
Re:So many bad takes. Learn from the Prime Video microservic... by crote on Monday May 08, 2023 @04:09AM (#35859201)
You can't really separate a language from its community, though.

You're getting paid to deliver business logic, which means most work is going to be gluing together libraries. This inherently means relying on community-written code, and related stuff like documentation and StackOverflow answers.

If the community is bad, the language isn't worth using.

Re:So many bad takes. Learn from the Prime Video microservic... by makeitdouble on Monday May 08, 2023 @04:27AM (#35859321)
IMHO this very discussion factors in whether you'll want a PHP stack or not.

If you're looking for pragmatic devs that don't care much about the trends, the community or peers' general opinion about a technology, going with PHP will get you this type in spades. Especially if you're looking for experienced engineers.

If you want devs that care about thoughtful designs, elegant solutions and want to enjoy the community, it will be a lot more difficult (not impossible, but it's an uphill battle)

And this has little to do with PHP's viability per se, there's just so much baggage that most devs will self select in one side or another. A language's base design philosophy matters, and it's always better to chose a stack that matches your own philosophy.