Upcoming Developments in the Recess PHP Framework
A number of balls are currently in the air and in motion with respect to development on the Recess Framework. I wanted to take some time to provide a 'State of Recess Developments' update.
View Layouts & Templating Layer
Joshua Paine has been leading development on a thin templating layer sitting above native PHP. The system enables master layouts which have areas that will be filled with content. These areas are called 'slots'. View templates which 'extend' a master layout can fill slots with 'blocks'. Blocks are chunks of HTML output. Master layouts can be extended by intermediate layouts in a nestable fashion. Kev burns created this diagram of the system which helps visualize how these concepts fit together.
Along with layouts will come a view helpers system and fundamental helper classes. Helpers provide simple methods to output common chunks of HTML.
This exciting templating system will become the defacto View layer for Recess.
Plug-in Model
The inspiration for a standard Recess plug-in model bubbled up from three prominent community members (Kev Burns, Jamie Rumbelow, & Luiz Zaiats) independently. Right now we are in the spec'ing process and exploring the design space for plug-ins. The current train of thought is that plug-ins will offer developers the ability to drop entire components of functionality into a Recess application. Components can range from an authentication system to specific special abilities on Models. There are some key high-level design questions which deserve deliberation:
- What does it mean for a plug-in to have controllers and views?
- Can apps interact / override a plug-ins controllers and views? How?
- Should plug-ins be shared across apps? Or are they contained within a single app?
- For plug-ins with models, how should they specify/install default data? (i.e. an address plug-in may need to have a country table pre-filled)
- What does the ideal plug-in installation process look like?
- What does the spectrum of possible plug-ins look like? The smallest example of a plug-in? The average plug-in? The most expansive plug-in?
Let's do some thinking on these questions around while we continue prototyping.
Extensibility Points
In anticipation of the upcoming plug-in model Kris has been rewiring the fundamentals of Recess' internals. A new, core class has been introduced: FrameworkObject. The purpose of FrameworkObject is two-fold:
- to standardize the process of expanding annotations on a class, and
- to introduce a new type of extensibility point called 'Wrappable Methods'.
Central classes like Model, View, and Controller now extend from FrameworkObject. Important methods in Model, like insert() and update(), and important methods in Controller, like serve() and init() are now wrappable. Wrappable methods can be wrapped by classes implementing the IWrapper interface. The IWrapper interface has two methods, before() and after(), which are called before and after method execution. The before method has an opportunity to manipulate arguments being passed in, while the after method can post-process the response. With pre-existing attachable methods, a standard annotation expansion process, and wrappable methods Recess should be beautifully extensible.
Model Validations
Making use of the new wrappable methods infrastructure is a model validation system. Validations will typically be specified as annotations on the fields of a model. More complicated validation logic will be specified in a validate method. Validations will be structured as an internal plug-in that a standalone model is unaware of. This is in line with one of Recess' core philosophies which is to maintain a light weight core which can be extended or replaced. The big open question with validations is which are the most important types of validators to bundle and support?
Conclusion
Some very exciting new features and capabilities are on the books to be rolled into a Recess release in upcoming weeks. Stay tuned as detailed tutorials are posted to demonstrate how you can use these new developments in your Recess apps for a faster, more enjoyable programming experience! Huge thanks to the developers in the community making this next big step for Recess possible!
Comments
Recess can only be as good as the thoughts that go into it. Let us hear yours...