PHPNW10: Michael Peacock: Abstracting Functionality with centralised content
Most content on web sites and web applications, such as pages, e-commerce products, blog entries, news articles and even job vacancies, comprise mostly of common attributes. By centralising this content at the Model and database level, extending upon a core set of tables for more diverse content types we can save development time by sharing functionality to all content types. User features such as commenting, rating, viewing content as an RSS feed, and administrative functionality, such as CRUD functions, deactivating content, rolling back versions, and moving content within a site or menu hierarchy can be applied to all of the content types. This approach is similar to how content works in Drupal, with all content stemming from a node. By combining this with a simple MVC architecture, new content types can easily be dropped in, with models inheriting from a parent content type which holds the data common to all content types, and controllers inheriting from a parent content controller, which centralises hierarchies of content of each type, and CRUD functions.Through real examples, this talk would show developers how to save development time, increase efficiency, and reduce testing time by showing how content can be centralised, and functionality can be abstracted so that it can easily apply to any type of content, without any additional work. This would mean an e-commerce site with product ratings, could add ratings to pages, blog entries and other content, without any extra development work.This is the perfect complement to any MVC based development framework, making code even easier and quicker to extend. Since introducing this approach to our own frameworks, productivity has increased dramatically, and as new content types are added, only a few lines of new code need to be added to get the full set of CRUD functions.Associated Slides