Earlier quoted context omitted.
I don't think bringing up deprecated functions is valid criticism. Everyone uses PDO these days.
Everyone should be using PDO these days. Whether they are is another matter. :(
Taking PHP Seriously [pdf]
121–130 of 155 posts
Re: Taking PHP Seriously [pdf]
#122Re: Taking PHP Seriously [pdf]
#123Re: Taking PHP Seriously [pdf]
#124Earlier quoted context omitted.
Ever notice how everyone who complains about PHP are usually complaining about WordPress, Joomla, or other such apps?
Because these apps exist . WordPress, for example, is unparalleled in other language domains. What is the WordPress of Ruby? And in python? Is it Django? Where's the plug-in directory for Django, equivalent to [1]? I work with WP, I'm the first to recognize it's an old codebase with all defects this entails, but popularity has value. Value that PHP critics dismiss too lightly. [1] http://wordpress.org/plugins/
Re: Taking PHP Seriously [pdf]
#125Earlier quoted context omitted.
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…
PHP may have a bunch of ways to shoot yourself in the foot, but you get a new foot back right away. IMHO the oddities in PHP rarely hit you, and when they do you'll pick it up right away in PHPUnit, fix it, and walk away.
Re: Taking PHP Seriously [pdf]
#126At 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;…
Also, your TL;DR is a flat out lie.
Re: Taking PHP Seriously [pdf]
#127Earlier quoted context omitted.
$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.
8 is sane here. The + operator adds numbers. It converts the string to a number implicitly in the process. it takes "0x4zz5" and tries to parse as much as possible. Since "z" is not a valid hexadecimal digit, it stops at z, and reads it as 0x4. Of course, it is better to manually convert.
It's the computer equivalent of a bozo worker who does something random everytime they don't know how to do their job, and then tries to hide any consequences while whistling innocently.
Re: Taking PHP Seriously [pdf]
#128Earlier 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…
Like php code, php itself is often confusing and hard to decipher, currently I think it of it as a C dsl for web stuff that people mistake for a high level application framework.
Like C, many people learn basic syntax and functionality in school or as a side project. Unlike C, people believe that that their skillset is the one required to build a complex server side application combined with a web ui.
If you realize the mismatch and account for it, you can build great php websites. The problem arises when people assume they are getting a 'faster/cheaper' .Net/Java stack and start to hire programmers into that structure.
The net result is a clash between people that are using PHP as intended, and people that have been subjected to the misuse of the php.
1. http://stackoverflow.com/questions/5647598/cannot-import-use...
Re: Taking PHP Seriously [pdf]
#129Most 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…
I think it is fair to contrast PHP with RoR or Django, because it was built specifically for generating HTML. Ruby and Python are general purpose languages that do many more things than generate web pages. No one writes iOS apps in PHP but they do in RubyMotion. No one writes high performance Math routines in PHP but they do in Python.
You have things like Rubymotion(to build iOS and Mac apps), which I'm really liking. Opal which translates Ruby to Javascript. You can build Android apps with Ruboto. You can run Ruby the JVM and call Java libraries. You can run Ruby on the .NET runtime(Iron Ruby). You have a really good Web framework called Rails. Most other PHP frameworks just copy Rails, so why not just use the source. You can build games for iOS using Joybox(library for Rubymotion).
So from a business prospective we chose Ruby because we can do pretty much everything in Ruby. We rarely have to use anything else. From command line applications, to web, to iOS, to Android, to reporting, etc.
PHP, well, you can output HTML, or JSON.
Re: Taking PHP Seriously [pdf]
#130Earlier quoted context omitted.
8 is sane here. The + operator adds numbers. It converts the string to a number implicitly in the process. it takes "0x4zz5" and tries to parse as much as possible. Since "z" is not a valid hexadecimal digit, it stops at z, and reads it as 0x4. Of course, it is better to manually convert.
Well, I'd say it's never better to "try to parse as much as you can" and when encountering such an error simply silently give out a nonsense answer. It's the computer equivalent of a bozo worker who does something random everytime they don't know how to do their job, and then tries to hide any consequences while whistling innocently.