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).
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.
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”.