New idea for the FA framework
I came up with a sweet idea for the FA framework. I'm not sure why it never occurred to me before.
For templates on complicated pages, they inevitably become composites of different components. Each component will either be dynamic or static. Consider the two bars at the top of OneLobby pages. They appear differently depending upon whether or not the user is logged or not. These bars are therefore dynamic.
Currently, the most common approach to dealing with these common components is to create a filter to deal with their initialization (determining the guest's status and showing/hiding certain parts). This is fairly clean, but it is not clear that the filters are related to template components and it is inconvenient to have the filters execute only where necessary. Instead, I'm going to try and create a 'pull' system.
Components will become new 'first class' items in the template engine. Components will have their own controllers and views. They can request their data from all the same models as existing controllers. The major difference that I see as beneficial is that the template engine will be able to load components as necessary and said components' code will be found in clearly defined locations. In this way, the template engine will 'pull' components as necessary.
In writing this post (I havn't written any code yet), it occurred to me that everything is essentially a component with one 'root' parent component. This 'root' component will be the equivalent of the current controllers.
I am not sure how i will implement the component hierarchy or how I will deal with passing data to child components, but it seems to me that this will create a more flexible system for development. My only worry is that for people attempting to understand code using FA, they will have to refer to views to figure out which components are called on a given page.
The primary reason for this new idea is caching. If each component has responsibility over its own view, components can create an opportunity for component-level caching. If one component is merely a static element, or can be given a lifetime, or can be given an expiry condition, then it can be cached and rendered from cache. Logic can be put into base classes to try and propagate caching up the component hierarchy as well.
Anyway, give me some feedback on what you think about these ideas. If you do not know anything about FA (FileArts), I encourage you to take a look at some of k4st's blog posts (
Flyingwithfire). There is a svn repository that contains it on the net but I'm not sure if k4st wants me to share that. ![]()
PS: why do logged-in users have to deal with a kaptcha?
?!?!
Is that new?
