NOTICE:
This content is in the "archives" of Gadgetopia. It has been moved to this subdomain as it is no longer considered relevant to the site. It is being hosted here for a indeterminate period of time. Its existence at this URL is not guaranteed, and it may be removed at any time. If you would like to refer to this content in the future, you are encouraged to save it to your local file system.

PHP: The Camaro of Programming Languages

Originally published by "dbarker" on 2005-11-01 16:00:00Z

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:

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:

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.)

I use Smarty, but there are dozens of options.

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.)

(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.

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.

ADODB handles this beautifully.

We run eAccelerator. There’s Zend Optimizer too.

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.

Comment by "The .NET Friend" on 2005-11-01 12:43:00Z
>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. If built-in meant modded, instead of standard equipped, sure. But that's like saying your '94 Honda Civic is the same as my BMW M5 because you found some after-market parts that make it go just as fast. Sure, you Honda might be fast, but it's still no BMW M5 -- no matter how many parts you cram into that rice-burner.
Comment by "Deane" on 2005-11-01 12:52:00Z
>it's still no BMW M5 -- no matter how many parts you cram into that rice-burner. All a matter of opinion, I guess. Like I said in the post, I like that I can choose from dozens of different options when I need a piece of functionality. Making sure everything is from the same vendor just isn't that important to me.
Comment by "Joseph Scott" on 2005-11-01 13:46:00Z
The number of odd images and memories than ran through my mind when I first read the title of the post was scary! Interesting ideas. Sometimes being able to pick and choose instead of being required to do it one way (because that is the only way) is a good thing. Now I'm waiting to see people have icons of 4, 6 and 8 cylinder engines next to their PHP skill level :-)
Comment by "Brian" on 2005-11-01 07:28:00Z
>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. Uh...... no. I am a .NET technical lead/architect myself. I've worked with lots of other .NET developers over the past few years, ranging widely in experience and skill level. As a group, I don't find them to have been any better or worse, on average, than any of the groups of Java or VB6 developers I've worked with in the past (haven't messed with PHP yet myself). The tools don't make the developer, and I don't think that using .NET really implies anything other than "I happen to work in a Microsoft shop," or "I transitioned from VB6," or whatever the case may be. IMHO, think .NET **enables** good architecture, but even then, what does that mean? Sure, you can argue that using code-behind, for example, means you're using the view/controller aspects of MVC at some level, but you can still **choose** to write code inline if you don't know any better. You can implement an abstracted persistence model, or you can **choose** to fire off SP's directly from your button click events. Yeah, the patterns are there, but you still have to be able to see and understand them in order to say that you're actually "implementing good architecture." Some of the crappiest code and design I've seen has been in .NET, and I've seen some really awesome architectures implemented in VB6 (no, that's not a type-o). Just depends on who's at the wheel.
Comment by "Greg" on 2005-11-01 15:10:00Z
Of all things on this post, I enjoy seeing the ineffectiveness of AdSense in this instance of picking up the analogies and thinking this thread is about Camaros.
Comment by "Tal Ater" on 2006-02-22 18:33:00Z
This has become one of my favorite blog posts, ever. One that I quote over and over. I just submitted a gushy [Digg post](http://digg.com/programming/PHP:_The_Camaro_of_Programming_Languages) about it show your support.
Comment by "Jonas Maurus" on 2006-02-23 11:32:00Z
I'd just wish that you mentioned that this Camaro can have a real powerful engine, but, unless you have the 2008 version that's not out yet, it only works if the driver and his passengers are Western Europeans or US Americans. If someone else tries to drive it, it breaks down.
Comment by "Taylor Hughes" on 2006-02-23 14:47:00Z
ASP.NET has a lot of amazing features that allow developers to do some amazing things, and it's generally built on solid programming ideologies. What I've taken away from most of my experience with ASP.NET development, though, is that developers tend to take the platform for granted. It's way too easy with .NET to make completely over-abstracted, bloated web applications that take much too long to load and sacrifice server resources in the name of OOP and RAD. Moreover, building features that *don't* conform to the .NET model is nearly impossible. Microsoft tried to eliminate the barriers to web development with this "ASP.NET web form" concept -- they work just like Windows forms, so developers can easily transition from Windows development to Web development. But all that integration accomplishes is the introduction of inexperienced developers with misconceptions about how the web really works. Pages shouldn't auto postback 15 times to accomplish a simple task; pages shouldn't load huge datasets and only display 5% of the results; pages shouldn't maintain immense amounts of data in a 'viewstate' without anyone ever knowing. I've taken a lot of experience with .NET and worked it into my PHP applications. There is a lot to gain by using ASP.NET, and the platform truly has a lot to offer. Whether it's a Corvette or not is irrelevant, what really matters is who's at the wheel.
Comment by "Deane" on 2006-02-23 07:14:00Z
>building features that don't conform to the .NET model is nearly impossible. This is the trade-off with frameworks in general. Rails is the same way -- you *will* do it the Rails way, and that's all there is to it. Thankfully, it's a pretty good method, so you don't want for much. >"ASP.NET web form" concept -- they work just like Windows forms, so developers can easily transition from Windows development to Web development. But all that integration accomplishes is the introduction of inexperienced developers with misconceptions about how the web really works. I totally agree with you there. The attempt to make Web apps work the same way as desktop apps is heavy handed and annoying. They *don't* work the same way, no matter how much you try to ram that theory down our throats. That said, I really like C#, and I really like the way the .Net framework is laid out. It's just the whole theory of ASP.Net that drives me up the wall.
Comment by "qwerty" on 2011-11-16 15:47:00Z
"you will do it the Rails way, and that's all there is to it." Wrong! Rails makes it easy to override the defaults. Anyway: PHP is for amateurs,by amateurs. Anyone who chooses PHP is an amateur by definition. .NET exists only to lock you in, so in most cases it is a foolish choice, no matter how well designed it might be.