davegardner_me_uk - portfolio website ===================================== Author Dave Copyright (c) MPD Consulting Ltd; www.mpdconsulting.co.uk License http://creativecommons.org/licenses/by-sa/3.0/ Link http://davegardner.me.uk/ Version $Id$ What is it? ----------- This is my portfolio website - davegardner.me.uk I created it for two reasons: 1. I wanted to showcase my experience and start a professional website I can build on 2. I wanted to try out some new ideas regarding structuring OO projects How's it put together? ---------------------- There are really four layers to the structure: +----------------------------------+ | GUI - implemented using Smarty | +----------------------------------| | Domain model; eg: project class | +----------------------------------| | DAOs - grab data from MySQL | +----------------------------------| | Database - MySQL via mysqli | +----------------------------------| I wanted to try to incorporate Allen Holub's advice that "each object should be responsible for it's UI". However I also wanted to keep UI code outside my domain objects, allowing each to be "outputted" in a flexible way. To achieve this I used the concept of an "exporter" interface. The domain objects all implememented an "export" method, which took as a single parameter an object implementing this exporter interface. The idea is then that a "project" object can be asked to display itself as a summary (html.projectSummary.tpl) or as a more detailed overview (html.projectArticle.tpl). This can all happen without the actual object itself knowing about it. Allen's approach implemented a seperate interface for each object, with messages such as "exportTitle" and "exportDescription" - one for each of the key attributes of the object. I skipped this and just used Smarty's syntax of assign( $variable_name, $value) which seemed to work OK. Can I use it for my portfolio? ------------------------------ Yes - it's released under creative commons attribution share alike license: http://creativecommons.org/licenses/by-sa/3.0/