Earlier quoted context omitted.
In what ways is PHP less hassle than Python? I don't understand this argument.
Deployment, for one. sudo apt-get install Apache and PHP, then edit the Apache config to say, "use this directory." I love Django and Flask to pieces, but deploying a Python app is like building a hovercraft compared to PHP.
Taking PHP Seriously [pdf]
61–70 of 155 posts
Re: Taking PHP Seriously [pdf]
#62Re: Taking PHP Seriously [pdf]
#63Earlier quoted context omitted.
Hmm, how so? In general it seems to make testing things easier since nothing is carrying around state; a static method with the same parameters is going to run exactly the same way every time no matter where or when it's called.
You are unable to properly mock static methods. So, for example, if you have a AuthorizeNet class that has a static method ::submit(), if you test the code then every single time you run it you're pinging Authorize.net's servers, which opens you up to a world of hurt. Properly mocking methods allows you to get rid of this unknown and say, "The submit() method will return an array of this specified data" without Autho…
As far as static properties go, if you're mucking with those you're back into the world of storing state, which OO is more suitable for, but the whole point is to avoid doing that wherever possible. :) What I was getting at before is that we really use a mixture of both real OO and procedural with class-namespaces-static-methods wherever each thing makes sense, but given the nature of what most backend PHP is trying to accomplish, the latter ends up being the majority.
Re: Taking PHP Seriously [pdf]
#64Earlier quoted context omitted.
You are unable to properly mock static methods. So, for example, if you have a AuthorizeNet class that has a static method ::submit(), if you test the code then every single time you run it you're pinging Authorize.net's servers, which opens you up to a world of hurt. Properly mocking methods allows you to get rid of this unknown and say, "The submit() method will return an array of this specified data" without Autho…
Perhaps I'm missing something, what about static methods prevents you from having a mock AuthorizeNet class implementing the same interface but with a submit() method that just returns fake data? Perhaps there is something specific to the testing framework you use that makes this clunky? As far as static properties go, if you're mucking with those you're back into the world of storing state, which OO is more suitable…
I use PHPUnit, the de facto standard for testing php code.
To create a proper mock in it, you use getMockBuilder()
Re: Taking PHP Seriously [pdf]
#65http://blog.samuellevy.com/post/41-php-is-the-right-tool-for...
Please stop complaining about how horrible PHP is if you don't use it or have. intentions to replace it.
Re: Taking PHP Seriously [pdf]
#66http://blog.samuellevy.com/post/41-php-is-the-right-tool-for...
Please stop complaining about how horrible PHP is if you don't use it or have. intentions to replace it.
Re: Taking PHP Seriously [pdf]
#67Most of the criticism of php seems to contrast it with a language plus a framework. If you really want to compare, compare php with ruby or python, not Django or RoR. As for php encouraging shitty programming, a good bit of that is that so many more people program in php because its easier to get started with. This does not mean that just because php attracts shitty programmers that it doesn't have more or many aweso…
Re: Taking PHP Seriously [pdf]
#68obligatory X is better than php flames on the way.. php just works.. end of story
$productid = "0x4zz5"; print $productid + 4; If printing "8" is your idea of a working interpretation of that code, then PHP is the language for you. If not, then PHP doesn't work. End of story.
Re: Taking PHP Seriously [pdf]
#69Earlier quoted context omitted.
Things like this and some interesting developments from Facebook concerning them are mentioned in the presentation, so it would be nice if people would actually discuss that. Just a suggestion.
It's PHP. Unfortunately, enough developer got bit by the fact that PHP doesn't prevent you from shooting yourself in the foot, and shot themselves in the foot. So, you'd probably be pretty ornery too when other people had more discipline to use the language without shooting their foot and were also employing it successfully. You'd probably want to make assumptions, and word hard to belittle them. Insult them. And the…
Re: Taking PHP Seriously [pdf]
#70At this point we almost need to stop saying facebook programs in PHP. I know this was defending PHP, but look at what is happening. Facebook ( big engineering firm, lots of developers and resources ) could not get php to work for them short of rewriting the core (HPHP ) and then adding on features to the language that most other languages have determined are useful enough to be baked into the language. Here is my TL;…