Back in the 1980s, when I was in high school, the reigning Chevy performance cars were the Camaro and the Corvette. They were almost the same, but worlds apart at the same time.
Back then, you could get the Corvette and Camaro with near identical powertrains – the 350 cid LT1. They were both awfully fast for their time, and they both handled great. But if you said to someone “I drive a Camaro,” you got a different reaction than if you said “I drive a Corvette.” The name “Corvette” got more respect. Why?
It’s because the Camaro had a much wider range of performance than the Corvette. For a while in the 80s, they made Camaros with four-cylinder engines. They made a lot with six-cylinders. And then they made the V-8. But there were even two versions of those: a 305 for a while, and then the LT1 that was in the Z-28. So the nameplate “Camaro” was really all over the map in terms of performance.
So when you said, “I drive a Camaro,” what were you saying? You were saying, “I might drive a fast car.”
Conversely, the Corvette came with one engine: a big one. If you said, “I drive a Corvette,” you were saying “I drive a fast car” – there was no range into which you could fall. Any Corvette was a fast car, so the name “Corvette” became synonomous with “fast,” and was thus a more respected nameplate.
Programming languages have performance factors just like cars. And like cars, some languages perform better than others. They may or may not do things like:
Model-View-Controller architecture
Templating
Code compilation and caching
Object-orientation
Database abstraction
Data caching
Caching
Integration with an IDE
etc.
Some languages – like ASP.Net – enforce a lot of these. If you’re coding .Net, you’re probably doing a lot of the above because you don’t have a choice – the language guides you in that direction. It’s like if you have a Corvette, you have a big engine because you don’t have a choice – they all had big engines.
So when you’re say “I’m a .Net programmer,” you’re implying that you’re an advanced programmer who understand and implements all good the programming architecture that .Net enforces.
Which leads me to PHP – the Camaro of programming languages.
You see, PHP has a huge range of implementations. On the one side, you can code it like we were all coding Web apps back in 1999 or so – URLs map to an actual file with embedded logic, database-specific functions, procedural code, etc. This is the four-cylinder Camaro.
On the other hand, you can code PHP with URL abstraction, MVC architecture, database abstraction, templating, object-orientation, data caching, code compilation, etc. This is the Z-28 Camaro.
So, like the Camaro, when you say “I’m a PHP programmer,” what are you saying? You could be saying one of two extremes:
*
“I’m a total hack who knows how to copy and paste some code, FTP it up to my server, and hope I don’t get a cross-site scripting attackā¦but I don’t even know what that is. In short, I’m a four cylinder automatic.”
*
“I’m a code ninja that has designed and implemented my own MVC architecture, uses and understands every PEAR module on Earth, and is generally on the cutting edge of open-source developmentā¦and I do it all in a simple text-editor. So excuse me while I bury the tach at six-grand on my LT1 and take off like I was shot from a cannon.”
Or you could fall somewhere in the middle.
My point is that PHP development falls into a much greater range of performance than .Net does. .Net forces you to implement pretty well (in most cases – you can still write bad .Net if you really want to). PHP, on the other hand, lets you write and install utter crap on one extreme, and near-perfection on the other.
And this leads to one inevitable fact: ASP.Net developers tend to get more respect than PHP developers. They drive the Corvette, we drive the Camaro. They’re assumed to be implementing well, and we have to prove this because there are a lot of PHP developers who implement poorly.
I was prompted to write about this because I’ve had my first taste of ASP.Net lately. I’ve been doing quite a but of ASP.Net coding in the last few weeks, and it seems like a good framework for writing apps.
However, I got to thinking and I realized that ASP.Net has really just enabled me to program at pretty much the same level I was programming PHP in the first place. It’s nice and integrated, and all the pieces were written by the same vendor so it has a sort of polish about it, but it doesn’t really let me do anything new that I’m not doing now.
I already use things like:
- Object-relational mapping
I wrote my own mapper, but there’s DB_DataObject and now Propel, which rivals ActiveRecord, and that’s saying something. (I just noticed someone has implemented ActiveRecord for .Net.)
- Templating
I use Smarty, but there are dozens of options.
- Database abstraction
I use ADODB, but PEAR DB is great too. I actually use ADODB via the PHP extension written in C so there’s no appreciable performance hit. (But if you’re just starting with this, pick PEAR DB, because if you use PEAR modules that access data, they assume this is what you’re using.)
- URL abstraction
(Meaning URLs don’t point to actual files but URL patterns are routed to underlying files.) I wrote my own class for this in about 30 seconds, but I’m sure there are others.
- Output Caching
I wrote a fantastic class for this in about 10 minutes (when you get down to it, caching is pretty simple). There are dozens of these out there.
- Data Caching
ADODB handles this beautifully.
- Code Compilation
We run eAccelerator. There’s Zend Optimizer too.
- IDE
Zend Studio is fantastic. Eclipse with PHP support is good too.
(Related to this, I have a friend who codes .Net and with whom I fight constantly about platform choice. He throws all sorts of .Net functionality at me as alleged proof that .Net is better. All the functionality he’s mentioned over the last year – bar none – is available for PHP, but he’s flat convinced .Net is better because all of it is “built in” to .Net.
Let’s consider that phrase, “built in,” for a minute. When you say something is “built in,” what you’re effectively saying is “someone else wrote it for me.” And if that’s the standard by which you evaulate a programming environment, then open-source will win every time, because more stuff has been written and given away for open-source than for any proprietary platform. Ever.
By that standard, we can consider the entire open-source landscape as “built in” to PHP. The only difference is that I can usually pick from a dozen different options when choosing a component.
Sorry – rant over.)
The bottom line is that PHP programmers get less respect because there’s a lot of really crappy PHP out there, and that’s because PHP will operate at that level if that’s all you know how to do.
Additionally, in a lot of cases, .Net developers started with PHP (or classic ASP, the crappiness of which they project onto PHP) and are basing their opinions on the really crappy code they turned out back then. They haven’t kept up with the language, so they haven’t been exposed to PHP implemented at a high-level. They still think all PHP is implemeted poorly, and that all Camaros come with four-cylinders.
So, in the end, let me say that ASP.Net is certainly a credible programming environment. Nothing in this post should be construed as me denigrating .Net or saying that it’s anything less than a good, solid way to code Web apps.
But make no mistake: I don’t consider it anymore effective than well-written PHP. (The key phrase there being “well-written.”) It’s no worse, but it’s no better either.