Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's absolutely true, but I was using the generic MySQL lib as a kind of common-ground illustration. The actual point translates just as well to any other DB library. Establishing a connection to the server and issuing queries takes a lot of time and often times it's done for all requests even if some of them don't need fresh DB data.


Yeah, except you're talking about PHP Pitfalls and failed to mention and then fell victim to and perpetuated the #1 Pitfall of PHP: Legacy Cruft.

PHP's libraries are full of Legacy Cruft that any other sane system would have deprecated and eliminated during a major revision transition.

The wholly inefficient and unsafe legacy MySQL lib is one of the primary examples.

Good on you for at least mentioning parameterized statements, but you didn't really follow through. You then go on to confuse the situation by talking about the old API.

Instead, you should have just said "Using this old API is a horrible idea. Don't. Ignore every guide or tutorial that does."

PHP has evolved considerably from its roots. The #1 problem with PHP is that it still lives in its parent's basement and hangs out with the same losers it met in Kindergarten.


Couldn't this be seen as a "benefit" - not having to rewrite code after every major release?


You still do. They do break things with each major release, sometimes in a big way. (Fatal-by-default errors for some types of "bad" OOP code and not setting the timezone in PHP 5.4, for example). Just not as much as some other languages.


You are more than welcome to not fix all of the security holes created by and allowed to exist by the old API.

Script kiddies everywhere will "benefit".


I don't really agree with that criticism. The first DB example I used was all about parameterized queries. Still, that doesn't absolve people from at least thinking about escaping stuff, that's why this other example is in there. But I get your point, I'll append the section to make it clearer why I'm referencing a legacy library.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: