.

PHP sucks - But I Still Use WordPress

I had to post a link to this. It’s basically another of the PHP sucks rants. This one is actually very well written. (I did not infact know about the memory leak cause by returning references in 4.4).

Here’s the real reason I posted it though:

Jonas Maurus’ maurus.net » I’m sorry, but PHP sucks!

You have found the ideal framework or base for your software and it’s written in PHP

This website runs on WordPress. It has by far the best UI of any weblogging application. It also means that I have to navigate around all the problems I mentioned in this document. My guess is that in the long run that will take more time than not using a PHP based weblogging application, but for now, I just wait for PyBloxsom to catch up.

I think this is really a testament to how great WordPress is. I have met a number of PHP-haters who run WordPress (Hi Corey). That to me is ultimate validation. Sure if you get under the skin it can get ugly - but are far as using it goes - it’s been smooth sailing.


Using Perl code from PHP

Zend Technologies - PHP 5 In Depth - Using Perl code from PHP

Ok so apparently this is over a year old - but I just found out about it. Basically, you can actually access Perl code from within PHP. I guess that means if there is a CPAN module you can’t live without - now you don’t have to.


Finally a Reason to Like Hibernate

Ok I’ll admit that I mostly skimmed this article :

TheServerSide.com - Hibernate vs. Rails: The Persistence Showdown

I don’t do Java - so it’s not like I’m going to be working with Hibernate any time soon.

This crash course in the difference though gives me two great insights into Rails (Which I’ll have to confirm over the next few weeks)

1. Rails is built around ActiveRecord pattern. To be honest that works great when things are simple - but I already have a couple of apps that out grew that - it does how ever explain how Brett was able to build everything so fast and automagically.

2. Hibernate uses Identiy Map,Data Mapper, Unit Of Work. What can I say - I’m such a big fan of these patterns I actually implemented them from scracth in PHP. The good news it - it was pretty easy to do it in a dynamically typed language like PHP - and with Ruby real Object model it should be even easier to work with.

Now I’m offically intrigued.


Being careful with list($x,$y) = func($z);

When you are writing PHP and you expect an array back from a function you can do this

list($name,$age) = function($person);

There is one small problem with doing this. If the array that comes back is not the proper size you are going to get an error.

As I see it you have two options :

  • Make sure that the function defaults to returning an array of an approriate size. This is possible easier said than done
  • Get the array back do nomal tests on it before you start assigning it

So basically, the list() function is handy - but you have to be very careful when you use it or it will blow up.


Python vs PHP ad nasuem

Why Web Programming Matters Most

Python never had a chance against PHP

Ok so there are these two articles. Both start to deal with Python vs PHP. I suppose this issue is close to my heart if for no other reason because I currently manage an application that is half written in both. I have also gone down the path where I tried to do everything in Python because it was such an elegant language, and ended up giving up and switching back to PHP. Not just because of some issues I faced working with Python - but external ones as well.

Python suffers from a serious popularity problem. People who like it love it. But most people have never even heard of it (although this is improving). That has a dramatic impact on the usefulness of the language to me. Because even though it is much older and more mature than PHP, there are fewer people who:

  • Build in it
  • Release apps in it
  • Write books about it
  • Write web sites in it
  • Run conferences about it
  • Write magazines about it
  • Train people in it
  • Have experience with it

That means when I go to hire for python it’s harder to find canidates who are experienced in the language. When i need a tool to tack on to a project I’m buidling there are fewer choices.

Neither the Python nor PHP community is great at marketing. You have to assume that people are voting with their feet (or their typing hands as it were). And that is self reinforcing. Once you go to a book store and see 20 books on PHP/MySQl and find 2 on python - you get the feeling that everyone else is going one direction. So even if you add even more to Python in terms of features that doesn’t guarantee that you will reverse the trend that lots and lots of new developers cut their teeth on PHP not Python. And I will tell you if you don’t get them when they are young you will only convert the ones that are serious enough developers to learn more than one language.

A couple of years ago, I was at OSCON and a presenter talked about how when you pick a language you aren’t just picking a language, you’re choosing to join the community and people who work in that language. So to make a gross generalization, even though most developers can code confortably in multiple langauges - the communities related to each are very different. Just look at the Java community as compared to the Perl community to see a perfect example of this.

I won’t characterize the Python community because I don’t feel I’m part of it.

On the PHP side - here are just a couple of things that suck about PHP

  • There are inconsitantly named functions.
  • The language and be messy.
  • It allows you mix your presentation and logic.
  • It is terribly inefficient by recompiling the code on ever excution.
  • $ variables are so 1980.
  • The object model is only now starting to be fixed.
  • Most of the code out there is complete crap.

I would say that the community is really like that old saw about the millions of monkeys at typewriters. You take all that terriblness,you add in tons and tons of coders who don’t know a data structure from their elbow, and you get a moutain of crap code.

But in the end - the monkeys produce Shakespeare. That’s right I said it. There is so much code out there that sometimes people get caught up in the crappiness of it all , but that doesn’t mean that all of it is crap.

For example right now I’m writing this using a piece of PHP software that isn’t crap called WordPress.

In PHP, people just get code out there. And yes it sucks, and yets it is terrible, but it is out there. And if it is a good idea it will get better.

Truth to tell I’m not sure any of the language advocacy really matters anyway. People choose a language and try to do what they need to do. If they can, they do. If not, they give up or try something else. It’s a simple loop that means people pick the first solution that is good enough. The market has already answered how it feels about PHP and Python.

I see a lot of parallels between this discussion of Mac OS 1-9 and Windows. I was an old school Mac user. I loved it. It was great. It had a few problems but they were nothing compared to the problems that I saw with Windows 9X. And I made the same kind of - why do people choose such a sucky platform - Mac is better arguments with my pc friends. And it didn’t change anything. Apple eventually understood that - they changed dramatically with Mac OS X. I will tell you based on the number of new power books I see among my peers they have done something right to turn the tide. If you really want Python to do the same, you need to figure out how to change the playing field. Otherwise accept that you have a great language that is clean and elegant and just not used very much.

As one last aside, I also find the advocay funny - because I don’t believe that the language is as important as I once did. Sure it can make things easier on you, but the reality is there are a lot of things that going to building a great application that have to do with presentation, flow, meeting a users need ….. that are the same struggle in all languages.


    You are currently browsing the Economy Size Geek weblog archives for the 'PHP' category.
    Categories
    Archives

    .