During my studies I helped to build an online tutorial website for first year students at The University of Waikato. My job was to revamp an existing site and turn it into something more professional. A large part of the code-base was rewritten, utilising libraries for page generation (PHP HTMLifier), restructured MySQL database, and creating a fresh looking front-end.
Almost all of the existing code was replaced. My HTML generation library for PHP (PHP-HTMLifier) was used throughout to generate pages. This library removes the need to spread echo statements throughout an otherwise HTML document, making the code much easier to read and maintain. The SQL database had redundant fields removed and inconsistent field names made consistent. New linker tables were added to remove data duplication and facilitate simpler updates.
One thing I really liked about Django was the way database tables are handled directly as Python classes. This makes things much simpler for the programmer because they don't have write a query to get a row from the database. Imitating this, I implemented wrappers around database tables that handled rows the same way. This made dealing with the database much cleaner and simpler.
The following code snippet gives an example of how compact the page generation logic has been made.
$section = new Section($sectionId)
line, which creates and fetches the relevant question from the database.
If fields within the object are changed during run-time, they are automatically saved to the database when the object is destroyed.
The site had to make it easy for lectures to add new content.
Usability improvements made here were
- Ability to navigate through all questions while in the editor (no need hit the back button).
- Asynchronous saving and image uploading to prevent interruptions while adding content.
- Automatic answer shuffling - so the content editor doesn't have to worry about correct answer position patterns.