Portfolio - The Creation Of Bigbook
Bigbook was my first attempt at application level PHP programming. To begin with, I read up on object oriented PHP to get a feel of how objects were put together. Investigating the principles of Model View Controller design gave me a good idea of where to start.
First Attempt
My first attempt at object oriented coding ended with the following structure:
- A master data object controlled connections to the database. In the early stages I added no further functionality to this object. It should eventually handle all database queries.
- Two children of the data object, one for accessing the text table and another for the user table. These objects managed data input from forms into the database, and could be passed HTML templates to populate with information from the database. They could also be used to find data, returning arrays of data objects as results. Returning data as a dataobject ensured the options to easily save or delete data was always available. These objects were robust, but duplicated a lot of code between each other.
- SQL queries assembled in both objects
- Templates populated in both objects
- Large find method essentially duplicated in both objects
- A page maker object was responsible for passing user inputs to the correct data objects and rendering pages. This object seemed overly complicated; it would be helpful to move some of its functionaliity to an object specifically for dealing with output of html from templates and data objects, and to split the remaining methods into seperate controllers for each area of the system