Do less

Tweet

So I got persuaded into blogging for Sitepoint and this is my first post. I’ll be writing mostly about PHP, since that’s my main area of competence, but will probably touch on related topics.
Anyway, in an attempt to not turn this into yet another “Hello World”, I figured I would reflect a bit on what’s special about PHP.

PHP doesn’t do stuff

It basically boils down to one thing; PHP doesn’t do stuff for you.

Taking a look at the hordes of extensions, which comes with PHP by default — or the overwhelming array of core functions — it may appear that PHP does an awful lot of things, but it doesn’t. Not really. This functionality is mostly passive; When you look at the language core, it makes very few assumptions about the application, you’re going to build. Instead, it supplies the tools to do so.

This is the tradition of open source. Linux is renowned for having a multitude of desktop environments, shell interpreters and whatnot. PHP follows the same organisation. It does have a one pivot point though; The language itself has only one official implementation. Well, two actually, but that’s hopefully going to be fixed eventually.

PHP doesn’t have a framework ..

These days, application frameworks are all the rage. Simply put, a framework is a body of rules for how you write an application, backed by a collection of libraries to support this specific way. The rules guide you, when building your application, and the libraries integrate better, because they can make assumptions about your application.

Rails was the one lifting it from a fad to the hype it has become, but PHP has its own fair share. It should be no surprise, given the diversity of extensions and libraries for PHP, that there isn’t a single defining framework, unlike most of PHP’s competitors. That’s a bit of a problem, since frameworks tend to be mutually exclusive — At least to some degree.

.. and it won’t either!

Some might say it’s a matter of time before one will rule them all. I rather believe, that the unique nature of PHP is exactly in its diversity. This diversity is ensured through the lack of a single application framework, which is tightly integrated with the language.

That’s not to say, that there isn’t room for frameworks, but it will always be in plural. This makes them fundamentally different than the monoliths of Ruby or .NET. Whether that is uplifting or depressing is a matter of personal temper, but it’s indisputable.

Now, that should prompt some comments.

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • PHP Penguin

    This is exactly why I have stuck with PHP – even the lure of a free book couldn’t persaude me to stick with RoR…

    I just felt it too restrictive on how I did things, that it clamped down on ingenuity.

  • http://www.lowter.com charmedlover

    Äntligen! En person från Norden på Sitepoints Bloggar. :-)

    Anyway, you make a good point about PHP. However, this does not attract me to ASP, it draws me towards Rails instead. I still use PHP though, lol.

  • http://m0n5t3r.info/ m0n5t3r

    @penguin: there is a free book for php5 too, you know? :P

    on-topic, rant mode on: you’re right, php is just a (somewhat primitive, poorly implemented, crippled for commercial reasons, but eventually easy to deploy and scale) language; it’s good that there are several frameworks, the problem is that I have yet to find one that doesn’t suck: Symfony, the “enterprise-ready” framework supported the 0.6.2 stable version for a few months, then the docs and the svn tag were wiped out (and don’t get me started on propel retardness), Cake wants me to write too much; the closest I’ve found to what I’d like is the Zend framework, which has a good library, gets a lot of things right, but has me writing way too much code for CRUD stuff.

  • AlexVN

    >That’s not to say, that there isn’t room for frameworks, but it will always be in plural. This makes them fundamentally different than the monoliths of Ruby or .NET.

    I’m sure Zend Framework will be de facto standard and will beat all other frameworks in the future.

  • http://www.tonymarston.net Tony Marston

    There will never be a single framework which is all things to all men. Each framework has to be geared towards the type of appliation you are trying to write.

    For example, if you are writing an administrative CRUD application to maintain the contents of numerous tables in a database rather than a fancy website, then you should take a look at http://www.radicore.org Starting with nothing more than a database schema you can generate and run a family of tasks to search, browse and modify a database table in 5 minutes flat, all without writing a single line of code (PHP, HTML or SQL).

  • AlexVN

    > There will never be a single framework which is all things to all men.

    Yes, but there is always a framework which 80% of developers use. Who ever use a framework, of course.

  • Sam “DaMule” Hennessy

    There will always be at the very lest two PHP frameworks, a “Glue” framework like Zend and a “Full Stack” framework like PRADO.

    But knowing PHP developers there will always be lots of frameworks, just look at the world of PHP template engines to find that out.

  • Ronnie

    @m0n5t3r

    You should notice that 99% of current documentation is still valid for 0.6.2.
    If you don’t like Propel you can use Doctrine.
    With regard to being enterprise ready check out what Yahoo is doing with Symfony.
    And finally if you don’t like PHP why on earth do you use it?

  • http://www.pixelsoul.net pixelsoul

    Meeh im still drawn to cakephp :D But it’s not perfect either.. but at least the php framework choice is not so hard as a linux distro it’s kinda silly how many distro’s there are now :D