Live data from Hacker News

High Quality PHP

acquia.com

91–98 of 98 posts

Re: High Quality PHP

#91
post #69

Earlier quoted context omitted.

You are in the wrong universe mate. And you are missing the point. It's not just about the language it's about all the other things around the language. How easy it is to find a webhotel and get started, how easy it integrates with HTML, JavaScript, CSS. Of course it's ugly, but who besides a bunch of snobs and people who actually can't use it really cares? Who should care?

> How easy it is to find a webhotel and get started, how easy it integrates with HTML, JavaScript, CSS. Good! We can see you clearly haven't tried using any of the many frameworks that easily integrate those things. > who besides a bunch of snobs and people who actually can't use it really cares? The people who later have to re-write these garbage projects, for one. I guess you've never had a client with a failed PHP…

Oh please.

Plenty of jobs no matter what language have to be rewritten for many different reasons.

The fact is, and that is what you guys seem to have a problem accepting is that PHP is a perfectly reasonable tool for many reasons and for many situations.

Get over it. Make it as easy to get started with your preferred language rather than blaiming PHP.

Re: High Quality PHP

#92
post #79

Earlier quoted context omitted.

And that is the point. For most people it's not disadvantagous so they use it.

Having spent a very long time in the PHP community I doubt that quite a lot. I am strongly skeptical of the notion that most are in the headspace to be able to evaluate alternatives effectively if they know they exist. Because most of them sound like you in your posts in this thread: circle the wagons and call everyone who says PHP isn't a smart choice a "hater". It's a very insular, very screwed-up social dynamic th…

Listen here.

I reacted to the typical criticism made about PHP which we saw again in this thread. The OP was about well written PHP and of course it turns into a PHP is bad.

Well boo freaking hoo.

PHP is a great tool. If you dont like it anymore dont use it. If you fear it will hinder your companies future success even though it seems to serve FB amongst others just fine for a while, dont use it.

But please, please, please, dont confuse your own personal opinion about what is good and bad with the fact that for many people PHP is a great tool.

Re: High Quality PHP

#93
post #65

It still baffles me that whenever an article like this comes up, people still justify choosing PHP because of its ease of setup compared to other languages . Seriously? What are you going to tell me next, that you chose Ruby because the "Hello World" tutorial was 15 minutes shorter, than the Java one? Come on now. Yes, the fact that PHP is easy to setup may explain its popularity, it doesn't however justify choosing…

Lots of hate for php in this thread, but this has me thinking: does anyone know a better solution to solve my problem? I have to build a CRUD-like webapp for some database, and with a bunch of authentication and authorization. Lots of forms and reports, think MS access. I was planning to use symfony2 and a generator bundle for this, as symfony2 has those things build in and the generator will write a lot of the code…

That depends on your skills. The time constraint you provided leaves little room for other solutions you aren't already familiar with.

That said, for your use case (since you're thinking of symfony2, it's clear that performance isn't an issue/concern: http://www.techempower.com/benchmarks/#section=data-r8&hw=i7...) I think Django is almost certainly a superior alternative. It comes with a built-in authentication and group/role-based authorization system, a built-in 'admin' system that can be used to serve up basic CRUD forms for your models with minimal effort, and the ability to code custom 'reports' as add-ins to the built-in admin system with only minimal additional effort. If your models aren't terribly complex you could have a test-ready basic CRUD app matching your description in less than 30 minutes, 90% or more of the code for which will have been generated (or come pre-packaged) for you.

Re: High Quality PHP

#94
post #79

Earlier quoted context omitted.

Having spent a very long time in the PHP community I doubt that quite a lot. I am strongly skeptical of the notion that most are in the headspace to be able to evaluate alternatives effectively if they know they exist. Because most of them sound like you in your posts in this thread: circle the wagons and call everyone who says PHP isn't a smart choice a "hater". It's a very insular, very screwed-up social dynamic th…

Listen here. I reacted to the typical criticism made about PHP which we saw again in this thread. The OP was about well written PHP and of course it turns into a PHP is bad. Well boo freaking hoo. PHP is a great tool. If you dont like it anymore dont use it. If you fear it will hinder your companies future success even though it seems to serve FB amongst others just fine for a while, dont use it. But please, please,…

With the typical reaction. "Thousands of sites use PHP just fine". "I don't care about the quality of libraries or the design of a language, and if you do, you're a snob". Trite.

And I doubt I, and many here, will ever make or work with a company which can have the leisure to rewrite the language implementation.

Re: High Quality PHP

#95

Earlier quoted context omitted.

Critique is fine but it just need to be based on other things than taste. Point to a thing you cant do with PHP and you have valid criticism. Critiquing PHP because you you think it's ugly or not elegant enough is only valid if you care about such things and then you are by definition a snob.

You're reframing all criticism towards PHP to "can it be done with x" from "is it best done with x". > Point to a thing you cant do with PHP and you have valid criticism. s/PHP/Brainfuck Does your argument still hold? Are you now a snob?

The OP was about beautifully written PHP code.

The comments I am reacting to are those who are reframing that discussion into a discussion about PHP as a tool in general.

So no I am not reframing anything. I am reacting to the reframing if anything.

Re: High Quality PHP

#96
post #76

Earlier quoted context omitted.

Fair enough, but not every application has to be ready for huge growth. E.g. for a guestbook the fact it wouldn't turn into a tire fire should you decide to turn it into facebickr or googipedia is a rather small benefit, and if it comes with higher setup costs it's actually a drawback. Some people just scratch the itches they have, right now, not the itches their expertise makes them think they should have, or the li…

> Because at some point, down the road... can't we cross that bridge when we come to it? No, and that's the problem. Nothing gets rewritten, it gets hacked on. PHP makes hacking on things, past a really low bar, really hard given what you get out of it. And the early benefit washes out pretty quick once you spend more than a couple days on a project. Setting up Play 2 (or Rails, or Django) is going to take me maybe f…

PHP is great for 90% of the cases.

In those last 10% you are right 50% might be really bad, 25% ok and 10 good.

Re: High Quality PHP

#97

Earlier quoted context omitted.

Listen here. I reacted to the typical criticism made about PHP which we saw again in this thread. The OP was about well written PHP and of course it turns into a PHP is bad. Well boo freaking hoo. PHP is a great tool. If you dont like it anymore dont use it. If you fear it will hinder your companies future success even though it seems to serve FB amongst others just fine for a while, dont use it. But please, please,…

With the typical reaction. "Thousands of sites use PHP just fine". "I don't care about the quality of libraries or the design of a language, and if you do, you're a snob". Trite. And I doubt I, and many here, will ever make or work with a company which can have the leisure to rewrite the language implementation.

Thats not the typical reaction. The typical reaction is to go on a hate fest about PHP just as it happened in this thread purely based on some self-established criteria for why it is so bad.

Case in point. A post about high quality PHP gets turned into a discussion about PHP as a language.

Re: High Quality PHP

#98
post #49

I believe "high quality PHP" is an oxymoron. It's just impossible to be aware of all the pitfalls PHP contains. Here is just one example among many: > if( '33333333333333333333' == '33333333333333333334' ) echo "equal"; Output: "equal" The "reason" for this very odd behaviour is that the two strings are automatically converted into integers, which leads to an int overflow, which PHP ignores (ignoring errors is very P…

I just tested this (PHP 5.4) and I don't get this behaviour. In this example the two are compared as strings not integers so are not equal. PHP does not automatically convert types unless you do something like this: if( 33333333333333333333 == '33333333333333333334' ) But here the problem is the integer overflow not specifically the type conversions. You are going to get weird behaviour no matter what you do because…

Not entirely true. PHP definitely tries to perform a numeric comparison on two strings if it thinks they are both numerical strings, but this behaviour changed in PHP 5.4 [0]. heron87's scenario was reported as a bug [1], changed in PHP 5.4 and caused new problems [2].

See the string comparison routine in 5.3 [3] and 5.4 [4]. The new implementation still inspects the strings to see if they are numeric and then tries to do a numeric equality check rather than string equality check, leading to amusing tricks like

     var_dump("0xFF" == "255.0"); // true!
But if both values overflow the long type and their double representations are equal, the new implementation falls back to actual string equality. A quick check at [5] shows that both values heron87 compared have identical double representations, assuming (sizeof double == 8), so the new representation detects the long overflow, then it sees that double representations are also identical, and then it returns to string equality rather than numeric equality. The old implementation did not consider long overflow and ended up comparing the numeric values.

[0] http://3v4l.org/a0nKq

[1] https://bugs.php.net/bug.php?id=54547

[2] https://bugs.php.net/bug.php?id=62097

[3] https://github.com/php/php-src/blob/PHP-5.3/Zend/zend_operat...

[4] https://github.com/php/php-src/blob/5.4/Zend/zend_operators....

[5] http://babbage.cs.qc.cuny.edu/IEEE-754/index.xhtml

Post reply on HN