A little history…
This project intially started from general interest as well as to improve my skills in PHP, MySQL, Application Design as well as using Unix, and Apache from developing websites but during it’s development has created many difficult and confusing situations. As i’ve figured out how to fix those problems they’ve unleashed more resulting in numerous rewrites of the source code. I was always sure to separate logic from presentation in every area possible except the occasional condition or loop in the source code.
Here is a little timeline on the rewrites of the site and problems which made it necessary.
Late 2006 - Version 0 (first alpha)
The site was entirely coded in procedural code and it very quickly became hard to manage and keep track of where all the needed functions were for different aspects of the code. Back then I also used a template parser and only in the last version did I opt out of using such a tool and instead just turned back to using php as it’s own template parser. Another issue with that was the useability of code being that nothing was reused at all causing extensive bloating of the overall code.
This was soon scrapped for version 1 (alpha), stated below.
Early 2007 - Version 1 (first alpha)
Two or so months later the start I decided to attempt a basic Object Orientated Approach which worked well but was coded in PHP 4 rather than PHP 5. For at least three months this version was further developed and after a month the site was back to it’s former glory. Of course though as it was one of first serious attempts at building a site in an object orientated style. I wasn’t to sure on using pointers/references so objects were continuously iniated as they were needed rather than reusing the already iniated objects. This took it’s toll on the site and it started loading slow on some areas which is quite pathetic thinking that there were only 4 active testing accounts on the site and no more than 20 posted comments.
The way I did it was by enclosing all the different sections in of the site into their own classes and initated them as needed. This was extremely buggy at times as was extremely resource intensive. Infact the site was probably more so coded in procedural code rather than object orientated code.
For a month or so after stopping the development in that way I just read numerous articles on object orientated programming styles such as the Factory pattern, Singleton pattern and of course my favourite the Model View Controller pattern (MVC). It was not until version 3 that something like MVC was actually used, instead version 2 used a slightly different pattern which I can’t precisely put a name to because alot of it was done how I thought was good.
I guess not.
Mid 2007 - Version 2 (first alpha)
As mentioned above I started using my own little pattern. Just like all the other ways I coded the site it did work well and but I only stuck with it for a short period of time. When it was being worked on no way near as many problems were encountered as in the previous coding styles. This version as well as the last still using a template parser and although only lightweight it still significantly increased the resources that the site used on every request.
This version mainly turned out to be for testing for how I can do the future version and it ended up helping alot in various aspects of object orientated programming. Not only did it improve how I viewed the code but also how I reused various aspects of the code and only created one instance of each object not numerous like the previous version. No more than 6 weeks after I started working on this version was it halted and the next version started.
Late 2007 - Version 3 (first alpha)
The final version that i’ve created and hopefully the last for the framework. This version works like the mvc in some ways in that there is a single entry point and a controller, model and a shared view (as well as tempaltes). The templates are parsed in php rather than in the template parser I used before and that in turn halved the amoutn of memory used to process one page.
The basic way the site works is that the users request is made, the entry point determines what was requested and selects the specified controller and model. Within the controller the specific action is located and processed as well as retrieving the required data from the database and other sources. It is further altered in the controller then passed onto the view object then outputted to the user. Doing it this way has also allowed some sections of the site to very quickly be build as alot of the needed functions and libraries has been created to cater for this and could easily just be reused. Not gonna say to much more because that’d ruin the secret to how it completely works.
There are still various places where alot of improvement can be made and that is done as I find or get the chance to fix the issues slowing down the site.
As you can see there have been various speed humps in my development of the site and in the future i’m sure many more will arise but I guess you could say that is all part of the learning curve.
on July 25th, 2008 at 1:52 pm
[...] The reason for the move is because the framework I was using just doesn’t seem to function so well. There are various methods in the classes which could be reused but aren’t because of the initial way I coded it. Information on previous versions can be found in my post about the projects history. [...]