Tuesday, June 20, 2006

IERI R3: On PEAR and Code Separation

PEAR Components

I was trying to decide if I should utilize some of the components available via the PEAR library. Some of these components are under constant development and so would provide a significant source of well-written and debugged code. Specifically, there's a authentication/permission module that might integrate nicely with the utility. Upon further thought I decided that for now I'm going to try and do a lot of the coding myself (except for the occasional module). This is my first major PHP application and I feel the best way to familiarize myself with language is to do the programming as much on my own as possible. By taking my time to develop the code myself I should be better able to evaluate third-party code in the future.

If future revisions of the utility are created it may be benefitial to look at incorporating PEAR components where possible.

Code Separation

On another note, I was thinking about the separation of processing code and user display. The more separate the two aspects of an application the easier it is to update either one. IERI is one of the more complex applications I've developed and it's a bit difficult to determine how to best achieve the separation. I've not gotten very far in the current development (authentication completed) but I can already see how even something so simple as authentication could be utilized as a separate component from the user interface for user login (allowing authentication via JavaScript, for example).

I do plan on attempting to separate the code from the display as much as possible in anticipation of AJAX-oriented development down the road. I guess one of the questions I have right now is how much extra time will be required to rewrite an integrated page into a separated one. I'm hoping that any pages I develop singularly will be fairly easy to upgrade if I utilize function calls and other methods of extracting the logic from the normal processing flow.