What I like in PHP

Last Week, I was in Open Days organized by Istanbul Bilgi Univesity and LKD (Linux Users Association in Turkey). It was a great event, very precious people gave conferences. It was really educational and more importantly fun.

I have joined a workshop done by Erek Gokturk about Ruby and Ruby on Rails. I was really curious about what was going on there. I follow the PHP Planet and other rss too, especially blogs of Terry Chay made me curious about “Are these people really that much asshole?”.

So I was especially curious about what it will be told about Ruby and Ruby on Rails. It was a short workshop, just a bit more than 2 hours and I can say that I liked the Ruby language (As a scripting language, allowing you to do your job with quick and dirty methods but also with a clean interfaces, the block statements, all was cool). I was not that much impressed with Rails though. It was yet another MVC framework helping you to create web sites easily. It was especially dump to be forced to have a database to create a web site.

Later the workshop, I had a little chit chat with Erek Gokturk and some other people who had joined the workshop. When I said I was loving PHP, one of them looked at me and said: “I’m not saying anything to projects built by PHP, WordPress for example, it’s great! But the core PHP code sucks. It has really lots of problems and it’s pretty annoying to work with it“. I was a bit shocked and felt frustrated, even I’m not a fanatic about languages, It’s not cool when some one criticizes tools you are using. I feel the same way, when some one criticizes Java or C# or Perl. They are merely tools and we, as software developers, are more interested in software architecture than it’s implementation. I’m not trying to say that, implementation is not important. Of course not, what I’m trying to say that, if you are a good software developer, you have to overcome your prejudices about languages and choose the one which best fits about your requirements. IMHO, non scripting languages sucks! I really don’t like to develop with Java and likes. I hate when I’m forced to do something. Scripting languages, like PHP or Ruby or Perl or Python gives you the freedom to create your own architecture. They are not forcing you to create classes which are inherited from other classes where there are lots other constraints about how I write. I’m a software developer, and I’m capable enough to create a good, flexible, reliable and secure application. If I can’t then I have to work harder and try to be a better one. That’s nothing to do with the language I use. It’s always possible to write bad applications with Java too. You can not blame the language because of bad inexperienced developers.

That’s what I love in PHP. You can always use your quick and dirty ways to fix some problems. Buy you can also create an enterprise application rich of classes, interfaces and other kind of things you can use in Java. Well of course, support is another problem.

If there is a PHP Way, than I think it’s about results. PHP Developers generally have an idea and PHP is the fastest way to implement it. What I remarked that, Python and Ruby developers have a great love for the language, have a great admiration for what the language can do for and what they can do with it. They think that the joy is in the process more than the results. It’s perfectly normal for them to write thousands lines of code and delete them and rewrite them to create a code which looks better and to match the changes they made in the architecture which changes very often. But PHP guys, they do not hunger to write thousands of lines of code. They want to put online the idea they have! They have an architecture good or bad, and they try to stick to it. But it’s not a problem if they sometimes move away from it (the quick and dirty way:).

When a PHP guy stumbles on a problem where PHP can’t do something, it comes perfectly normal to me when the guy says: “Oh, I have included in my php ini an extension which enables to run perl scripts with my php scripts. I have solved the problem with it“. It’s very dirty and gives you the chance to create a spaghetti code with phps, htmls, perls, javascripts, masons. But the problem is solved, right?

The above problem creates a huge impact on Ruby Ruby on Rails or Python developers. It creates an even greater impact on Java or C# developers (well, eventually they just give up or start to send some emails or start to rewrite the code they have written before for a work around or to avoid it). Python guys puts too much confidence in their language and they think that it’s the language that works but not their architecture. So for them it’s nearly impossible for them to encounter such a problem but when they do they accept it and try to find a way to solve it (maybe recompiling python with some other options where this problem can be solved)! Ruby on Rails is a bit more problematic because they don’t try to solve it. They don’t even see such a problem can occur. Because they think a framework or a language must be optimized or created for developer happiness but not for success.

I think that’s the PHP Way! A language, a way to success. You enjoy with the success of your idea. You are flattered when some one comes to your site and do something. Because this means you are doing something good! I really respect the guys in Twitter. They had this great idea (Well, IMHO, not that great…), even they had a code base which was unable to handle their page requests, they did not give up because they were believing in their idea! I guess that’s what really matters, a worthy idea.