Yet another anti-PHP rant

I’m quite surprised to see this great stir in the blogosphere caused by Tim Bray and his essay On PHP. I mean, what’s the deal anyway? We all know that PHP is a lousy programming language. So instead on focusing on the big picture and trying to list as many of its faults as I can remember, I’ll stay on one specific problem, which is really a pain for me.

I’ve been programming in PHP for the past five years (I’ve started using it in the beginning of 2001, during my Computer Science studies). PHP is (was?) both my love and hate. My biggest complain about it, and probably about all other programming languages used for web development, is that there is no decent way of producing HTML code from your application. No matter how hard you try, you’ll always end up having spaghetti either in your HTML or in PHP code (or even worse, in both places). Sure, separating business from presentation logic is a common practice which helps the cause (apart from the fact that most PHP folks mix HTML with PHP whenever and wherever they can). Problem is, that it’s not good enough.

It would be all much simpler if you didn’t need to put any logic into your presentation code. The moment you introduce loops or conditionals – bam – you either get unreadable code or spaghetti HTML with way too much whitespace (or without any whitespace at all) and improper indentation. Not to mention that I am probably not the only one sick of typing all those nasty angle brackets all the time. But what about all that specialized templating engines? Frankly, they are not any better. Besides the fact that some of them require a certain overhead (like defining the variables you wish to use in your templates – Smarty, anyone?), they all still carry the same burden – they either produce spaghetti HTML or have spaghetti templates.

Actually, Rails, being my current weapon of choice, is no better in this area. My .rhtml templates are a complete mess. I strive to have my HTML as pretty as it can be, because (maybe strangely) I find it easier to debug if I have a nice HTML output to deal with, instead of a nice .rhtml template. Too bad that I feel utter disgust when I look at those templates. And just as Smarty is no better for PHP, Liquid and similar projects are no better for Rails. However, there is still hope, with projects like Markaby (which, unfortunately, has its own issues, check the comments).

Just a small digression, to sum all this up. Rails has solved one other, big inconvenience, namely writing your own SQL for each and every interaction with the database. Thanks to ORM provided by ActiveRecord, you don’t have to write SQL any more (at least in most of the cases; the 80/20 rule). This is one of the basic reasons that Rails is so much better than PHP. Markaby tries to do the same to HTML, what ActiveRecord did to SQL. No more those nasty < /> characters! We’ll see how (and where) it goes.

2 million Firefox users in Poland

According to a recent measure (article in Polish) conducted by Gemius (a Polish company tracking internet users in our country) the number of Firefox users in Poland has surpassed the two million barrier, giving it a 17% usage in the browser market. That, of course, does not give us the lead in Europe, but in my opinion it’s a pretty high number. And, of course, it’s climbing. Here’s the chart:

Firefox usage in Poland

Go, Firefox!

UPDATE: It seems that ranking.pl (the source of this chart) counts each cookie as a user, while in fact there are way more cookies than real users (check the comments for details).

Review: Anthony Zimmer (2005)

Anthony Zimmer (2005)

I must admit that my jaw dropped after spotting Sophie Marceau in Anthony Zimmer. Her first entrance is simply stunning. Only then I have realized she was basically the sole reason I was watching this movie in the first place. It’s been so long since I’ve seen her on the big screen… Not like she stopped acting, quite the opposite, when you look at her filmography, you’ll see many titles, year after year. The problem is, most of them are of doubtful quality, so I just skipped them. Anthony Zimmer is a single exception since Fidelity (by Andrzej Żuławski), that has caught my interest. I was heading for a big treat and thankfully I wasn’t disappointed.

Anthony Zimmer is not in any way exceptional. You might even go as far as saying it’s just your typical French thriller. And you’ll be mostly right. Mostly, because it is so much more at the same time… First of all it’s not just a thriller, it’s a psychological thriller and there’s a certain distinction between the two. In practice it usually means less shooting and action replaced with more acting and talking. Actually, French cinema is quite good at psychological thrillers, maybe even the best? Red Lights, which comes to my mind, is the closest offspring from that genre – both movies share similar atmosphere and tension.

Second thing, which make Anthony Zimmer exceptional is the perfect cast of three main players. Aforementioned and always exceptionally beautiful Sophie Marceau as Chiara, Yvan Attal as Francois Taillandier and Sami Frey as Akerman, overshadowing the two. We get a glimpse of Daniel Olbrychski too, which was a treat on its own as he is a well known actor in Poland.

The movie starts and the game begins…

I would love to say that Anthony Zimmer left me speechless, but it is not so. Quite the contrary, it gave me a lot to write about.

Anthony Zimmer (2005)

Rating: 9/10