Perhaps the world doesn't need another framework

Thursday 25 Oct 2007

A collection of PHP frameworks

Well after the last post on this topic, it seems like frameworks are one of those topics that divide the PHP community. You either love them or you think developers who use them are weak, girly-men who probably can't open jars without help and only use frameworks because they don't understand how to write good, simple code. Me, I am that girly-man — but I do know how to write good code, thankyouverymuch.

The thing about writing a framework yourself is that it gives you the best possible understanding of how it works. There is not one part of that framework that you don't have to really think about as you code. "Do I really need this?", you think, or perhaps more likely, "I don't understand how that works — I'll leave it out".

While I coded I learnt about URL rewriting, dynamic methods, abstract classes (well, how to use them in PHP anyway) and a bit about form state persistence and the like. And the result is that I know exactly how to put my framework to best use for whatever the project may be. It may not be a good framework, but it's mine.

But...

But there's always a flip side. A comment by Joshua May got me thinking — he mentions that he had to work with an in-house framework at his last job, the author of which had previously left the company. With no documentation, he was "in the deep end".

And that's just what would happen if I left my current employer. A good number of products (including OurIntranet) are developed on my framework, meaning the company would be left to support something lacking formal documentation (though there is an API).

And really, that's not good enough.

Joshua is right. We need to stop reinventing the wheel. Community-supported frameworks will invariably beat their homegrown cousins. Sticking with the big boys is the easiest course of action for everyone: you get a stable, mature framework on which to build, and the people who have to support your work get documentation and a community that can help. A bit of research reveals that there are at least a dozen frameworks out there which are actively being maintained, and have various levels of community support. That's a lot of choice really. Surely one of them will fit your coding style and your needs.

Although..

If you still want to write a framework, it can still be a good idea and it you willl definitely emerge a better programmer. But if others may need to use it after you, make sure it's well documented. (Of course, if you're freelance, you're off the hook — the only person who has to support your code is you.)

And me? I still think there's no way I could go without a framework now. Madness!

But right now, I guess I had better get into that documentation.

About the Blog

I'm a web application developer in Melbourne, Australia, occasionally writing about related tech things.

If you need web design, development, or usability consulting, contact me via my business, Recursive.