10 PHP Myths Dispelled
View Single Post
01-08-2008, 01:20 PM
Join Date: Jan 2008
I must agree with Xenon and Karl, the arguments are mostly ones that have come before with many languages. And I have a few of my own comments, sorry for the verbosity.
3. PHP doesn’t follow MVC
To answer this could be long, but I'll be short. For PHP MVC is a choice, not a requirement. Unlike some other languages where things can be unnecessarily complex in a mere error page. The MVC model, Model <-> View <-> Controller, is little more than a concept that has been object oriented. The base concept is abstraction between the data, specifically large amounts of data, and the view.
Procedural PHP either follows, or doesn't follow, the MVC concept. It either has code/functions that control the varying data followed by the view creation code/functions, or it has the view creation strewn throughout the data aggregation. Event incorporated view handling with the data has separation, as this, by and large, comes from a database or the filesystem.
Object Oriented PHP follows the two options above in manner but is far more encapsulated. The objects would contain all the code for the data, view, and controller--and many libraries already provide this exact MVC framework. Even when the view and data are handled procedurally, bit by bit for page generation, the processes are still separate.
Arguably, I would say PHP is one of the few languages that is natively MVC compliant--even if only in concept, rather than strict definition. But in the end, the strictness of the MVC relationship is up to the programmer.
4. PHP is slow because it’s interpreted
Absolutely correct. But we're also talking in relative terms. Interpreted languages are slower by definition because they aren't compiled and must be interpreted. That said, I see a great many bloated walruses in many languages, especially C++ (compiled) and Java (interpreted). However, Zend makes a better toaster. It CAN be bytecode compiled from what I understand. And its efficiency competes directly with LUA.
Another argument that makes this point null-and-void is abstraction. If I give a C/C++ application and input it doesn't expect it will crash immediately--it was an error. If it doesn't crash this input was expected, and prepared against. Lets pretend you have a hard-coded CGI binary. You just lost your whole interface that touches that input. With the abstraction of PHP I can change one, maybe two, lines per function or object and make it handle any problems like this gracefully. This makes recovery less of an arcane art, and more of an impressive feature.
So, bytecode-uberspeed or interpreted-stability? I like the latter.
5. PHP doesn’t have a good IDE or Debugger
News to me.
is a good place to start; it is a PHP IDE. It even pops up as I pause in typing to tell me when and where I've got an error, without clicking debug or starting Apache. As a hobby I use Visual Studio 2008 (with Chrome, an Object Pascal extension language) and even those errors need arcane interpretation--PHP errors are pretty obvious, even when arcane sounding.
7. PHP isn’t really for “serious” developers
It's a good thing I'm not serious then. I make plenty of jokes. Or, is that why my .NET-ASP loving uncle is so angry any time I bring up why I disagree with him?
I'm glad "it's not for serious developers"... it'd give me ulcers otherwise. I've SEEN those serious folks, and they need to lighten up. Seriously.
(Anything C can do, PHP can do better!)
8. PHP is only good for web applications
A language being good at its purpose is a
thing? Correct me if I'm wrong, but not even Java is good at its purpose, whatever that may be. Java programmers are the first to admit to Java's many problems. But, PHP being good at what it is supposed to do is bad....
I think someone needs to see the psychiatrist.
2. PHP Encourages Sloppy Code
9. PHP code is a mess of “include” and “require” statements that break easily
10. PHP Code is rife with in-line SQL statements
Sure, if you write it that way. But even sloppy PHP can be understood, and isn't nearly so mind-warping as the C-Macro paradigms. And, believe it or not, even this sloppy, "bad", PHP is typically fast, efficient, and understandable!
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning.
- Rich Cook
View Public Profile
Send a private message to RobertK
Find More Posts by RobertK