PHP-DSL
March 8th, 2006, By Duncan Gough
Deep joy, the Zend framework launches… and gives rise to a wave of irritated reactions (the future of php is more depressing than ever, php developed ‘exclusively’ by 20 zend employees) and belated, warm applause (Zend Framework is out, it’s SitePoint, though, do be careful with those mouseclick-triggered, article obtrusive popups).
Ian Bicking has a great post called Towards PHP in which he correctly points out the reasons for the ubiquity of PHP – easy to develop, easy to learn, installed everywhere – and then wonders whether a similar Python approach could be started. Combine the two together, though, and you’re on to something. The Zend Framework is out, great, but what made PHP successful? Simplicity. Who uses MVC frameworks in Python and Ruby – experienced developers who are tired of PHP. Why do many experienced developers stick with PHP, even after learning all the bugs? Because you can comfortably knock up a site in no-time.
So, why doesn’t PHP take a leaf out of the Ruby on Rails book and create a domain-specific language. When it first came out, PHP made database driven web sites wildly simple. Now it’s bloated. The Django developers make serious jokes about this page, and they’re right. But, rather than building an anti-PHP style PHP framework that suffers from object bloat and ill-judged design patterns, why not create a DSL that accepts people will mix HTML and PHP, that people will globalise variables, that people will blindly accept user-entered input?
Do what Rails does. Make the simplest thing the correct thing and create a domain specific language, a version of PHP that doesn’t care about half the stuff in that standard library. Create ‘PHP-DSL’ with a handful of functions that systematically filter input, escape output, create valid html constructs, cache infrequently used data and so on. A version of PHP that runs in PHP but is purely focussed on creating web pages (hence, domain- or problem-specific), that does what PHP does well – no monolithic application server, no front-controller, shared nothing, etc). It’s a very, very strange feeling to admit this, but when I first saw the no-framework PHP-MVC framework I reacted much the same as everyone else, except that now I’m not so sure. In fact, I’m so not so sure that I’m discussing the fact that all PHPs’ weaknesses are its strengths and that we should embrace those strengths and create a mutant version of PHP that makes doing all those anti-framework PHP things simpler. Build a secure, fast, inline version of PHP that smuggles security, maintainability, scalability and MVC in the back door. If it runs in PHP it’ll run on every shared host that supports it. PHP-DSL has the potential to be huge.
2 comments
-
KingPin’s Den » PHP-DSL replied:
[...] A new concept in php, since PHP is so problem ridden, why not make it so much more easier to work with just like ruby on rails… Since peopleare going to go ahead and make the simple mistakes and always accept all input from visitors… mix HTML inside php to get some formatting… why ot give them an easier way to do it and move the security and structure to the side a bit where they still work but dont obstruct? well an article here suggests something just like that. the main page they refer to is : http://toys.lerdorf.com/index.php?url=archives/38-The-no-framework-PHP-MVC-framework.html. You have to love the goals for this approach: [...]
March 8th, 2006 at 2:08 pm. Permalink.
-
The mass amateurisation of everything, in code at Suttree, Elixir for Immortal Baboon replied:
[...] = “UA-148111-4″; urchinTracker(); « Turn on your magic beam The mass amateurisation of everything, in code PHP-DSL» [...]
March 10th, 2006 at 2:40 pm. Permalink.