- Posted by matt on August 21, 2008
I got into a discussion with a co-worker (and PHP programmer) about the PHP language and why a new project would ever be started using it over other popular languages. He happened to be on his way out from our company and was starting at a new development company where they programmed, near exclusively, in PHP.
Disclaimer
My exposure to PHP has typically been a forced one. I never actively sought to learn the language, but I’ve had to develop in it on numerous occasions and I can get the basics done with relative ease. I don’t claim to be a PHP programmer and I would call myself a novice at best when it comes to writing code in the language. I am a C# developer by trade.
To me, PHP does not seem to be a good choice for starting new projects that you plan on being successful. Every time I’ve seen a large PHP application, it just looked like a complete mess that nobody but the most familiar with the application could comprehend. The language was not designed to be object oriented (assuming you feel that OO is a huge step forward like I do), and they are just pushing some essential functionality to the language in the upcoming release of PHP 5.
PHP has always seemed like more of a client side language to me, probably because it’s basically a scripting language. It reminds me of classic ASP which I don’t care to be reminded of.
It has the following perceived problems in my eyes:
- It’s feature set seems crippled in comparison to other languages.
- It seems to take more code to accomplish the same task as other languages.
- You need to use 3rd party frameworks to get acceptable performance and scaling, let alone to get needed functionality.
- There is no good IDE for it that I have found.
- Most modules are not thread safe.
- There are no namespaces (yet)
- Configuring PHP can be a major pain in the ass, especially on Windows IIS.
- Session handling sucks.
- Object Oriented development is difficult, even with the new features. It just seems crammed in there.
I If you were going to create any type of serious program for the web, wouldn’t it make more sense to use a more robust language like Java or a .NET language? Yet, very large, very successful web applications are built on PHP (Wikipedia, Digg, Facebook, the list goes on…). New and innovative web applications are constantly being developed in PHP. Entire web development companies code in nothing but PHP! WHY!?
Reasons for using PHP?
Is it because there is less overhead with the code? I admit that I use .NET along with its AJAX.NET additions to write applications on a regular basis, and it sure does add a lot of unneeded overhead (not to mention ViewState). But it lets me write code so much faster by having access to the added functionality when I need it.
Is it because it’s free? I’ve heard that argument as a major selling point over and over again, yet just about every PHP developer I’ve met programs on Windows or a Mac. Besides, Java is free, the .NET language is free, and so are its (express) development tools. True, to avoid headaches you need a Windows server to deploy .NET applications to, but Java will run on that same LAMP server, just toss TomCat on it.
Is it because it’s easy to learn? Maybe. I would have to say that it’s got a flatter learning curve than the other languages and may be more inviting to the newbie.
One thing is for certain, PHP development isn’t going on in the enterprise, and for good reason.
A plea for help
Can someone tell me WHY you would start a new application in PHP? What are the benefits? If you knew PHP equally as well as Java or a .NET language, why would you code in PHP?
