So much loving and hating with PHP

January 7, 2008 § 1 Comment

As a developer that’s been coding PHP for so long and as a neophyte Pythonista, I have finally arrived at this crossroad.

Why PHP has to be this über-sharp-double-edge sword? See what I mean below.

(+) Low Learning Curve

PHP is easy. Darn easy language. Many, like this one, said that PHP allows non-programmer doing programming. That argument, I think, is the strongest point of PHP. The easiness contributes to hobbyist productivity, open source growth, thriving dot com startups, and students.

(-) Low Learning Curve

The same ease of learning curve, also contributes to another PHP limitation. It is difficult to teach discipline programming in PHP. What is the need of modern design pattern if having everything in 1 php file works well? In my mind, that’s similar to: why bother folding my clean clothes if I can throw all of them on the floor. I could probably find my clothes faster if everything is on the floor (floor == hash map).

(+) Productivity

Because PHP is easy to pick up, it clearly delivers, “something”. Whether it is a non-enterprise spaghetti or well baked web framework with fabulous arrangement, PHP accounts for productivity to its developers. Increasing productivity is obviously one good solid point of PHP.

(-) Productivity

But the same productivity can also be undone by PHP itself. Either because of the syntax, security, or many other things. These caused the very same developers to go back, unravel the mess that’s either self-inflicted or, unfortunately, imposed by others (e.g. middleware “enterprise” companies). The easy way to dodge this bullet is to passed on the mess to the succeeding developers, but that’s… lame.

(+) The Speed of Prototyping

As the productivity increased, the speed of prototyping will naturally increased as well. This is most definitely a good thing. Until…

(-) The Speed of Prototyping

The prototype gives developers the illusion that it is “good enough” for live deployment. Is it? A lot of prototypes I’ve seen weren’t born with unit-test that actually represent real-life use case (Really… writing unit-tests is not that time consuming). On top of that many were born prematurely. Most of the time, the answer is not.

There will be more bullet points, as soon as I could think of.

What I’m Trying to Say

The more I use & read Python, the more I’m exposed to this perspective. To some readers, hold on your horses, I’m not trying to brew a flamebait here.

This is not PHP bashing and Python is kicking-PHP butt type of posting. I still love PHP, I still use it a lot, & I’m still CakePHP fanboi.

What I am trying to say is that, being Pythonic can apply to any languages. While writing PHP application, programmers can still apply good design.

Being Pythonic doesn’t mean using Python, it means not repeating yourself in coding, keeping everything simple, clear separation between logic and presentation, overall simply good design pattern.


1. Even before I know Python, the similarities between my coding principles and Zen of Python is striking. Although I’m not 100% agreeing with “There should be one– and preferably only one –obvious way to do it”.


§ One Response to So much loving and hating with PHP

  • Ray says:

    Good little writeup! Being a long-time PHP guy who “discovered” Python three years ago, I can whole-heartedly agree. You’re definitely right when you say that Pythonic principles can be applied to other languages too. I still need to do quite a bit of PHP and I’ve found that the way I write PHP nowadays has become more efficient due to my “thinking in Python”. The signal-versus-noise ration when it comes to good practices is definitely highr in the Python community; I’ve since gotten rid of many common ugly habits. Don’t get me wrong, there are many examples of pristine PHP coding (look at ExpressionEngine/CodeIgniter); it’s just that you usually only find these in very tight teams, expreienced professionals and the odd natural talent/genius, of course, as opposed to the “dabbling masses”. I think it’s great that a 13 year old can write his own BBS or game clan statistics app, but you get what I mean.

    I think another point that made PHP so widespread is the easy deployability. Basically every cheap web host has been offering PHP for the last number of years, making it a no-brainer for most hobbyists. It’s also *relatively* easy to port apps between servers and configurations (although there are some annoying gotchas we all know). Python, on the other hand, is usually limited to CGI, which is near useless for any non-trivial script where performance is a priority. Although, since the advent of the recent “framework boom” (Django, TurboGears etc), it’s been getting better. It’ll be interesting to see how things develop over the next couple of years.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading So much loving and hating with PHP at RAPD.


%d bloggers like this: