If you are a Catalyst developer and hang out in the #catalyst IRC channel a lot, you might already have heard of Reaction. But even then, you might not be sure what it actually is. In this post I try to give an easy explanation for people already developing in Catalyst or for the web in general.
I could tell you that Reaction is the lovechild of Catalyst and Moose; that it focuses on reusability, long-term maintenance; or that it gives you interfaces built by introspecting your models and allows you to use the same introspection mechanisms when building your interfaces. But this is all very abstract, and only shiny if you know what it means already. So let me ask you a few questions:
How often have you written a basic authentication system, including the login and logout actions as well as the form and its processing?
How often did you end up with separate small templates that basically do the same thing, but are slightly different?
How often could you catch yourself thinking “All my iterations over records in my templates are basically the same. Shouldn’t there be a way to abstract this?”.
Did you ever wish you could subclass parts of your interface? Be it the display of items, collections, forms like logins, searches or registrations.
These aren’t the only solutions Reaction tries to provide. And while Reaction does ship with a few very helpful components, its core represents the tools to design, implement and use these solutions yourself.
At the core sits the interface model. It contains the objects, collections and actions that make up the domain of your application. A reflector is provided to inflate a full interface model from your DBIx::Class schema.
The structural logic and data to render as a page is contained in viewports, the actual layouts of the page components are organized in layout sets that belong to a widget containing the actual display logic. These layout sets are organized in skins. All this gives you complete separation of logic, and extendability down to a very fine-grained level.
I’m keeping this first post about Reaction deliberately short. There are many parts and concepts in it that allow many powerful ways of abstraction, customization and extension, and I feel it wouldn’t do them justice to merely mention them here.
If you are interested in Reaction, there has just been a new CPAN release with a more up to date documentation. The parts I would recommend to newcomers are especially:
The Intro will be giving you an idea on where Reaction is aimed at.
The Overview is trying to explain the various parts of Reaction and how they interact with each other.
In the Tutorial you will be walked through building a simple Reaction app as a basis to start on.
There is the RenderPage document detailing how a page is rendered in Reaction and what parts are involved.
In Widgets you’ll find a detailed description on how to use existing or write your own widgets and the layouts that utilise their functionality.
Stay tuned, there will be more!