RedFeather Architecture

One of the big selling points of RedFeather is how light weight it is. The intention is that a base install of RedFeather will be a single .php file which can be dropped into almost any web space to provide quick and straight forward access to digital resources. This objective presents a number of problems which require us to think carefully about RedFeathers arhitecture.

The tool must be a single file and it must run on almost any php install but it must be flexible enough that functionaliy can be trivally extended or over written. A fairly simple way to achieve this goal might be make RedFeather one “Class” and modifications can inherit from it. This is neither simple enough for our tastes, particularly when you consider running multiple extentions, but it also breaks our rule about running anywhere. PHP is a fairly ill considered language has only had object orientation since version 5. Since many servers run PHP 4 the software can not be object oriented.

RedFeather has a very basic but powerful aritecture. It allows you to define pages as a list of functions to be called in order. Each of these functions is then declared and registered in a function map. As each of the functions for the page executes they access a global variables hash and contribute to the proceedural building of a “page” which is then returned when all of the functions have executed. Ironically this model is not far from how many languages object model actually works.

This structure has a number of useful properties. You can easily insert a function into the list of functions which build the page. You can added new pages and reuse functions used to build other pages. Finally if you want to completely change what a function does you can write a new function and change the reference in the function map to point to your function rather than the one initially declared. Thus you can easily overwrite functionality and extend the functionality of RedFeather in a flexible way which is reasonably easy to understand. It is debatable whether this model would scale for larger code bases but the light weight nature of RedFeather means this hopefully will not be an issue.

Tagged with: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *