Monday, February 1, 2010

On Frameworks ...

So I was reading zby's latest blog post on frameworks and libraries. On some level I agree with him that often times frameworks are basically just codified "convention", but I really don't see this as a bad thing, and here is why.

As I see it, the purpose of a library is to provide generic re-usable code that can be used in many different contexts. The purpose of a framework is to provide a set of guidelines/conventions/best-practices which a developer can then build upon, therefore avoiding the need to set those guidelines/dictate those conventions/determine those best practices themselves.

Some frameworks are more opinionated and complex (RoR, Catalyst, etc) and push/force you into their way of thinking, the benefit being that they also provide you with lots of building blocks that often times are zero-conf. While others (Dancer, Web::Simple, Mojolicious::Lite, etc) are more focused and purposefully simple, they leave many problems unsolved therefore allowing more freedom for the developer. Each of these approaches has merit and neither is truly superior in all contexts, which brings me to Plack and why I think this explosion of "frameworks" is a really good thing.

The ubiquity of Plack means that all these frameworks can be (fairly) easily used within the same application (or set of applications). It should (eventually) be very easy to have your Catalyst application running next to your Dancer application, running next to your WebNano application, all sharing the same session data, user information, etc. through Plack::Middleware components and mounted under a single Plack::App::URLMap and controlled easily using plackup.