Ask Matt: Question from Bobby

Bobby asks:

What is the best web language today?
What is the worst web language?
Does the practice of one vs another show the capabilities of the developer, or the limitations of the task?

Those are some tough questions to answer.  I’ve somewhat talked about this before.  I would probably say that the problem is the question is too broad.  I’d really need to ask back, “better in what way?”

My personal opinion, and I point out that it’s merely my opinion because I’ve been pulled into debates with folks that disagree on this, is that the visitor/end-user’s experience is what matters the most (you have to draw your line in the sand somewhere, that’s where mine is).  I feel that most of the currently popular web languages are capable of producing the same result to the end user, so the developer should use what they’re most comfortable with, whether that be .NET, PHP, Ruby, etc.  You’re going to be able to find clients that will let you develop in any of those languages, so that’s not a sticking point to me.  It’s difficult to go much further beyond that without more definition around the question.  For instance if you wanted to take it down to OOP, one language might start shining compared to another, or if it was an issue of smallest learning curve, another language might take the spotlight.

I know some other folks that argue it’s whoever the client is might dictate the language, and I see merit to the argument, however I’ve also found that you can lead a client towards a particular language under many circumstances, aside from them already having an internal environment setup that they want you to develop for (although I’ve also had clients willing to setup an environment just for what I’m building them).  So, all that to say, there’s a lot of exceptions/gray area.

I personally prefer PHP for web development.  It has a low learning curve, outstanding centralized/maintained documentation (seriously … it blows the rest out of the water when it comes to documentation in my opinion), and an amazingly strong community behind it.  It’s also a strongly proven language for web development.  All one has to do is look at Facebook, Wikipedia, Digg, WordPress, etc, and you can see it hard at work.  Yahoo! also has a strong presence in the PHP community which has led to some great API’s for search, geocoding, mapping, etc.  Most of their services have an API, and most of those API’s will return results in serialized PHP, making developing on top of them very easy.

As for the second question, which is worst, I’m not sure I can answer that for many of the reasons I outlined above.  There are some horrible ones out there, but they likely started to scratch an itch, you can’t necessarily blame the language if it got bent out of it’s original purpose.

The third question is an interesting one.  I think I would likely argue that it would show the capabilities of the developer.  Given that I view choosing the correct language as what the developer is most comfortable with, I’m not sure that I could answer any other way.  I’ve yet to see a webapp/website built on a language such as Ruby on Rails/.NET/etc that I couldn’t replicate in PHP.  I might not be able to replicate something made in .NET in Ruby/on Rails, however that is not a fault of Ruby, it’s a fault of my knowledge of the language.

Anyhow, sorry it took so long for me to write an answer, it’s been a busy week.  Hope that at least somewhat answers how I feel about the questions.

This post is part of Episode 6 of the weekly Ask Matt Series.

Introducing: PHP Simple Cache

PHP Simple Cache is pretty self decribing.  It is a simple cache built for PHP powered websites that I have decided to release as open source.  It has a fairly narrow audience.  The most applicable website I can imagine for its usage would be:

  • Powered by PHP
  • Relatively static content, but still driven by a database / content management system
  • A need for reduced dynamic page loads / database calls

If that sounds like a site you operate, then by all means feel free to check out the PHP Simple Cache page I setup on Google Code.  If you’re interested in contributing to its development, let me know :)

My language is better then yours … (Part 2)

Jim decided to respond to my post regarding language vs. language debates, specifically looking at PHP and Ruby / Ruby on Rails. He makes some good points, but there is some stuff that I’d like to respond to and clarify…

To say that one language is better than the other is meaningless. Better in what way? The question should always be asked in a particular context.

I definitely agree, in general, I’m just tired of language vs. language debates … more on that in a moment.

I don’t want to talk about the ads, though, because they have their own agenda and it certainly doesn’t match mine.

Works for me, but keep in mind that most of my original post was working towards making the point that the video’s were doing an apples to oranges comparison of PHP (minus framework) to Ruby on Rails. Jeremy and I disagreed on the validity of this comparison.

For me, that’s why I am using open-source tools in the first place.

For me, the bulk of my language preference comes from language philosophy.

but for my tastes, I appreciate the additional power that Ruby metaprogramming allows.

These are some key points that I can agree with, but again, more on that in a moment…

PHP =~ COBOL is not an analogy I would make, but at the same time I’d urge you to consider your claim “You’ll always be taking over a Java project or a .NET project or a PHP project” in light of COBOL, or FORTRAN, or VAX or any other platform that’s been a dominant success in the past. Current popularity is no guarantee of future popularity. In our industry, better mousetraps are ruthlessly adopted.

I totally agree, as I even said, I can see PHP going by the wayside one day, but today is not that day, and I still believe it’s extremely premature to be concerning myself with but so much. It seemed Jeremy was arguing that Ruby on Rails projects are more easily taken over, so my counterpoint was simply that RoR, like any other language, is not likely to be so widely adopted that his point would ever really become something you could rely on. Just to be sure I’m clear, I’m saying that it is unlikely that RoR will become so widespread that you can count on commonly taking over other RoR projects. This is not me slamming RoR, the same statement could be made in the direction of PHP, .NET, etc. You’ll always be taking over projects built on other platforms. Even as a PHP developer I experience this commonly. Just the other day I had to take over a .NET project and we chose to redo it in PHP for various reasons. I hope that’s clear, and if it’s not I wish someone would ask the questions I need to answer to make it clear.

If your focus, like in your last paragraph, is only on user experience (by which I think you mean developer experience), then language preference may truly not matter. But if your focus as a developer is on avoiding future “forced” language changes, then it might make more sense to attempt to determine which new technologies might eventually usurp the old. My claim is that Ruby and Rails are better positioned to do so that PHP and its framework set.

Ok, finally to the point I kept putting off above. I actually was not speaking of developer experience. I was speaking of end-user experience, the folks that visit our websites. THEIR experience is what matters in the end. PHP, RoR, .NET, etc are all capable of providing similar, if not identical user experiences. So if I prefer to provide that user experience with PHP, using mainly procedural based programming, then why not? If you want to do so with RoR, or any other platform, then more power to you. As you indicated, there are things about RoR that make you prefer it over PHP. I see no problem with that. But to say those ways are better then mine, if achieving a particular user experience is the ultimate measure, is sort of pointless, unless you disagree that the languages are capable of producing similar/identical experiences.

I also want to comment on the fact that it seems in these conversations I keep getting pegged as being resistant to change, not eager to learn new languages, etc. To be blunt, it’s pissing me off. I’ve lost count of the languages that at some point I’ve been well-versed in, let alone the languages I’ve “dabbled” in. Just because I’m not actively learning RoR at the moment, does not mean that I think PHP is Gods gift to programming nor does it mean that I am resistant to new languages as a whole. PHP has its flaws. One day it will be replaced (just like .NET, RoR, and even Java) but I don’t think that day is tomorrow or the day after, so I don’t feel pressure to move on yet. I think RoR is doing some great things for the development community as a whole. Some things I see in RoR, I adopt in PHP. That kind of thing is good for all of us. But again, just because I don’t choose to use RoR, doesn’t mean that if something else came along I wouldn’t take the time to consider how it might could benefit me. At some point I’m sure I’ll re-assess RoR, and who knows, maybe I’ll dive in. Right now, it just doesn’t make sense for me to.

My language is better then yours …

(Fair warning, if you aren’t a nerd, you might want to skip this post)

Are we (programmers, developers, engineers) still really having these debates? Give me a break. Java vs. .NET, Java vs. PHP, .NET vs. PHP, now Ruby on Rails vs. PHP.

The other day, Jeremy, sent me these. They’re a series of videos created by Ruby on Rails fans, basically comparing PHP vs. Rails. I watched the videos and told Jeremy something along the lines of, “they’re funny, but they’re not really a valid comparison of the languages.” I’ll be honest, I’m too lazy to look up his initial response, but at some point he told me, “they’re entirely valid comparisons.”

My main point was that if you only compare based on what the video’s show, PHP is capable of doing everything Rails is, although the videos, if you knew nothing about the two languages, would lead you to believe that wasn’t the case. I conceded the point that at least to some extent, Rails would win when it comes to Migrations. But even that, you can mimic in some way for PHP, but it might not be QUITE as easily done. You can, without much trouble in fact, abstract your database from your code, you can do MVC, you can do OOP (in fact PHP5 has greatly extended OOP in PHP).

Then I allowed myself to be pulled into the language vs. language debate (although he will most likely claim that somehow we weren’t having a language vs. language debate). It was all quite silly … on both sides if I’m being entirely honest.

I like the fact that PHP will let me put together a quick script without having to go through MVC/OOP/etc etc if that’s all I want to do. I like that it doesn’t make assumptions about how I’m going to set things up, I also like that if I want to get very structured, or even apply a framework, I can. He believes that the fact that Rails forces (force is my word, he would most likely say it just makes a certain way so easy why would you choose another) you into a structure is a plus for the language/framework. He even went on to say/imply that a language that didn’t force that was inferior.

Some of the silliness came in to play later. For instance I think some of the helpers and whatnot available in Rails, while lowering the entrance barrier for new programmers, also create lazy programmers that don’t actually know how things are actually being done, or why it is being done that way. It was silly because earlier in the discussion I had argued that just because PHP allows sloppy code to be written, doesn’t mean the language is at fault, the programmer is at fault. I still don’t really back off of either of my points, I guess that line is just a little fuzzy for me. But I will admit that I could see how me arguing it one direction in one instance then flipping could be seen as odd.

Then later he made the comment that one of the problems in our discussions was we were comparing PHP (the language) to Rails (a framework). That being silly because everything up to that point, and past that point was and continued to be comparing PHP to Rails. Somewhere along the lines I asked if we were comparing PHP to Ruby or PHP to Ruby on Rails. Because if we were comparing PHP to Ruby, the videos were just nonsense. If we were comparing to Rails then we’d need to introduce Cake or Code Igniter on the PHP side, which would again make the videos invalid. He, in some fashion, agreed. Not sure why we continued from there, but we did.

He argued that the great thing about working within the framework and doing things the easiest/forced way was good for when picking up projects from others. My opinion is, you can easily setup standards and processes to create maintainable code within your organization regardless of your chosen language. So that leaves us with having to deal with picking up projects from outside developers. If you think that enough development firms are going to pick up one language so that when acquiring projects from another development firm that it will be easier because it’s written in your language, you’re living in a dream world.

Somewhere he brought up that he thinks PHP programmers are eventually going to go the way of the mainframe programmer, using COBOL as an example. Honestly, one day, that will probably be the case, but good grief that is a premature statement. There are organizations that would label PHP as cutting edge (I wouldn’t agree, but regardless, me myself and I are not the majority), not to mention the large number of large sites running PHP (Wikipedia, Digg, Facebook just to name a few), and Yahoo’s involvement in the community. I would say PHP is still growing, if not exploding. It’s hardly the time to be making funeral arrangements.

So anyhow, I think I’m done ranting about this, but needed to throw it out there. Just to be clear, I think Ruby and Ruby on Rails are great. I consider them powerful tools for development and have not and will not ever consider someone silly for wanting to learn them, nor will I think that my tool-set (PHP + framework or no framework) are somehow superior. I know the language vs. language debate is not going to end here and now. It never will. But, GAH! I’m sick of it. Use what you want to use. User experience is what ultimately matters and they’re all capable of providing similar if not exactly alike experiences. Anyone who disagrees with that needs to come out of their cave.