📅 January 2011 ‐ May 2011
🔨 PHP | MySQL
This project was part of a web server programming module that taught server-side programming techniques and related subjects such as HTTP, HTML forms, N-Tier architecture and database access. A classified adverts web application for an online newspaper was developed to demonstrate all of these techniques. The site required the following features:
The first task was to design the database, this was done using entity-relationship modelling techniques and normalisation. The database was created using MySQL. As this was a reasonably complex application, with a lot of use cases, a lot of thought had to be put into the design. I had noticed how complex PHP code can become when it is intertwined within HTML. You end up with a lot of little ‘islands’ of PHP amongst the HTML which is difficult to maintain and doesn't enable team working between programmer and designer.
An MVC architecture is one way of circumventing this issue. A lot of MVC frameworks are available but I wanted to come up with my own design to gain a deeper understanding. I sketched out some use case scenarios to picture how people would interact with the site. This then helped me come up with the required pages.
The final design incorporated a controller class which acts as the first point of contact for the application, directing user input to the relevant places. A model class handles database interrogation. Database information is then supplied to a relevant view page by the controller to show the information to the user. This approach ensures no overlap of functionality, meaning the business logic can be kept in one place, away from the presentation and data. This also has the additional benefit of allowing programmers, designers and database administrators to all work on the same project without conflict.
Once this skeleton architecture was in place it became simpler to incorporate all of the features into the site by extending the functions of the controller and model classes, and adding the relevant views.